Macro for converting every line in a drawing into two lines

Discussion in 'SolidWorks' started by Srinath Avadhanula, May 3, 2006.

  1. Hi all,

    I am completely new to the whole Solidworks macro thing. I was
    wondering if something like the following could be done:

    1. Scan through the present drawing and for every line in the drawing:
    2. Create two copies of the line which are offset from the present line
    on both sides.

    Basically, we have a drawing which cuts out fine on a machine which
    creates "thick cuts", however, when we want to cut out the same file on
    another machine which creates "thin cuts", some of the cuts are too
    thin. I thought that doing something like this would enable me to
    thicken the cuts on the second machine.

    Thank you,
    Regards,
    Srinath
     
    Srinath Avadhanula, May 3, 2006
    #1
  2. Srinath  Avadhanula

    Mr. Who Guest

    Yup, should be possible.

    Iterate through drawing views to select all edges and then use
    ModelDoc2::SketchOffset2.
     
    Mr. Who, May 3, 2006
    #2
  3. Srinath  Avadhanula

    Tin Man Guest

    This isn't a SolidWorks answer, but I'd look into using Cutter Radius
    Compensation (CRC) on your CNC mill if available. With CRC, you'd
    program the mill to the actual part dimension, and then the CNC
    generates a cutter path offset from your entered part size value by
    whatever diameter you tell it your cutter is.

    Ken
     
    Tin Man, May 3, 2006
    #3
  4. Hi Tin,

    Thanks for the reply.

    In my case, I am using a Laser Machine, not a mill. The machine we have
    doesn't have anything like CRC. It basically functions as a print
    driver so we need to create a solidworks file which it then cuts as
    seen.

    Thanks,
    Srinath
     
    Srinath Avadhanula, May 4, 2006
    #4
  5. Hi Mr. Who(?)

    Thanks for the reply. Could you please elaborate on how one "iterates
    through drawing views"? The hint about ModelDoc2::SketchOffset2 is very
    helpful.

    Thanks,
    Srinath
     
    Srinath Avadhanula, May 4, 2006
    #5
  6. Srinath  Avadhanula

    Mr. Who Guest

    1. Use DrawingDoc::GetFirstView (returns sheet)
    2. Then View::GetNextView to get each subsequent drawing view on that
    sheet

    Not positive what you need here - sketch lines or edges. Big
    difference.
    For sketch lines:
    1. View::GetSketch to get sketch associated with a view
    2. Sketch::GetSketchSegments to get all sketch segments
    3. SketchSegment::Select4 to select the sketch segments
    4. ModelDoc2::SketchOffset2 to offset them

    For drawing edges:
    1. View::GetVisibleEntities to get all visible edges, faces and
    vertices
    2. Entity::GetType to filter out edges
    3. Entity::Select4 to select edges
    4. ModelDoc2::SketchOffset2 to offset them

    Good luck.
     
    Mr. Who, May 4, 2006
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.