For those people doing sheetmetal with SolidWorks

Discussion in 'SolidWorks' started by SW Monkey, Jul 7, 2003.

  1. SW Monkey

    SW Monkey Guest

    What process do you use when converting your sheetmetal models for
    manufacturing? Do you export as another file type, or do you use the
    actual model itself?

    Im trying to get an idea of what the majority of people in the
    manufacturing industry that uses SolidWorks for sheetmetal does.

    My company currently exports the flatpattern in a drawing as a dxf.
    Then the dxf is converted to a GEO file by manufacturing. They then
    use the GEO file to make a nest for the laser.

    We have a hell of a time converting drawings to dxf, since the process
    is somewhat somewhat long.

    First we have to delete the sheet format, which has title block and
    notes on it. Next we have to manually hide the bend lines. Clicking
    "Hide All Types" doesnt hide these, although it looks like it does.
    Then we have to scale the drawing view 1:1. Finnaly, we have to
    export it as a DXF to a directory called N:\DXF.

    This process is very cumbersome, expecially when you have 20+ drawings
    to do this to. So that brings me to my first question. Im not very
    knowledgable of the sheetmetal laser market, so if the process we are
    using is the "old" way of doing things, maybe thats why SolidWorks
    doesnt have an easy way to export flatpatterns for manufacturing.

    If anyone has any suggestions/comments, please feel free to post a
    reply. Thanks.
     
    SW Monkey, Jul 7, 2003
    #1
  2. SW Monkey

    Mark Reimer Guest

    We created two macros. The first one takes a detail drawing and creates a
    second sheet without a title block, inserts a flat pattern view of the model
    if sheet metal, otherwise the front view, sets the view to HLR, sets it to
    tangent edges removed, hides cosmetic threads and deletes any other
    annotations that may have appeared. In the macro we use the function
    "CreateFlatPatternViewFromModelView2" with hideBendLines set to "True". It
    works very well. All that is left to do manually is hide any edges that
    might exist from features in the model like countersink holes or chamfers.
    We use a second macro to save the dxf to the appropriate folder.

    From API help...

    retval = DrawingDoc.CreateFlatPatternViewFromModelView2 ( modelName,
    configName, locX, locY, locZ, hideBendLines )

    Input: (BSTR) modelName Name of model
    Input: (BSTR) configName Name of configuration
    Input: (double) locX X coordinate
    Input: (double) locY Y coordinate
    Input: (double) locZ Z coordinate
    Input: (VARIANT_BOOL) hideBendLines TRUE hides bend lines, FALSE does not

    --Mark
     
    Mark Reimer, Jul 7, 2003
    #2
  3. SW Monkey

    FrankW Guest

    I'm a new user of SW here. most of the drawings I do is sheetmetal.
    I did a survey of our sheetmetal shops we use to determine what they
    would like from us.
    They wanted a 3d model of the part in IGS or STEP format,unfolded.
    And a pdf drawing of the detail information (paint spec,part number, etc).
    They "did not" want an unfolded drawing as they will take care of that
    themselves.
     
    FrankW, Jul 7, 2003
    #3
  4. We have been using Fabriwin for our NC for a Plasma Machine which I
    understand that the NC code is very similar. Fabriwin has an OLE
    integration to SolidWorks It takes the open part unfolds it if it
    needs to be unfolded and imports the unfolded outline for the cut
    path. Fabriwin is created by MetalSoft, based out of California.
    They also sell a nesting software called Intelinest.
     
    Corey Scheich, Jul 8, 2003
    #4
  5. SW Monkey

    SW Monkey Guest

    Mark, could you possibly send me that macro via email? If not, can
    you explain what I can add to my existing macro to automatically hide
    the bend lines? Thanks
     
    SW Monkey, Jul 10, 2003
    #5
  6. SW Monkey

    Mark Reimer Guest

    I emailed it to you, but here is the code for anyone else who is interested.
    I used a couple of predefined constants, so swConst.bas must be inported as
    a module in the project.

    '
    ****************************************************************************
    **
    ' CutPattern.swp macro last edited on 07/10/03 by Mark Reimer
    '
    ****************************************************************************
    **
    Dim swApp As Object
    Dim Drawing As Object
    Dim Model As Object
    Dim Annotation As Object
    Dim Sheet1 As Object
    Dim View As Object
    Dim ModelName As String
    Dim Sketch As Object
    Dim pAnnotation As Object

    Sub main()
    Dim Errors As Long
    Dim Warnings As Long
    Dim ModelExtension As String

    Set swApp = CreateObject("SldWorks.Application")
    Set Drawing = swApp.ActiveDoc

    If Drawing Is Nothing Then
    MsgBox ("Unable to attach to active document.")
    Exit Sub
    End If

    If Drawing.GetType <> swDocDRAWING Then
    MsgBox ("This macro only works with drawings.")
    Exit Sub
    End If

    Set View = Drawing.GetFirstView 'The first view is the sheet

    If View Is Nothing Then
    MsgBox ("Unable to get sheet view.")
    Exit Sub
    End If

    Set View = View.GetNextView ' The next view is actually the first model view

    If View Is Nothing Then
    MsgBox ("Unable to get model view.")
    Exit Sub
    End If

    ModelName = View.GetReferencedModelName ' Get the model file name referenced
    by the view
    ModelExtension = Right(ModelName, 3) ' Get last 3 extension chars to
    determine model type

    If View.IsModelLoaded = False Then View.LoadModel 'if model is not loaded,
    then load it

    If UCase(ModelExtension) = "ASM" Then 'open the assembly silently to get
    model object
    Set Model = swApp.OpenDoc6(ModelName, swDocASSEMBLY,
    swOpenDocOptions_Silent, "", Errors, Warnings)
    ElseIf UCase(ModelExtension) = "PRT" Then 'open the part silently to get
    model object
    Set Model = swApp.OpenDoc6(ModelName, swDocPART,
    swOpenDocOptions_Silent, "", Errors, Warnings)
    End If

    If Model Is Nothing Then 'If the model cannot be opened, then exit without
    doing anything
    MsgBox ("CutPattern Macro could not get model object.")
    Exit Sub
    End If


    'Add the new sheet and name it
    ' Format: retval = DrawingDoc.NewSheet3 ( name, paperSize, templateIn,
    scale1, scale2, firstAngle, templateName, width, height, propertyViewName )
    If Drawing.NewSheet3("CutPattern", swDwgPaperAsize, swDwgTemplateNone, 1, 1,
    0, "", 0.4318, 0.2794, "Default") = False Then
    MsgBox ("CutPattern Macro could not create drawing sheet")
    Exit Sub
    End If

    'Find out if the model is a sheet metal part
    If Model.GetBendState = swSMBendStateNone Then 'model is not a sheet metal
    part
    Drawing.CreateDrawViewFromModelView ModelName, "*Front", 0.215, 0.135, 0
    'Go with Front view if no Flat Pattern exists
    Else ' model is a sheet metal part
    Drawing.CreateFlatPatternViewFromModelView2 ModelName, "", 0.215, 0.135,
    0, True 'insert a Flat Pattern view
    End If

    Drawing.ViewZoomtofit2 'Zoom to fit view on screen

    'Get the newly inserted view
    Set View = Drawing.GetFirstView
    Set View = View.GetNextView

    View.SetDisplayMode (swHIDDEN) 'Set view to "Hidden lines removed" (HLR)
    View.SetDisplayTangentEdges2 (swTangentEdgesHidden) 'Set view to "Tangent
    edges removed"

    'Delete all annotations and hide cosmetic threads
    Drawing.ClearSelection 'Clear all current selections

    Dim gotsomething As Boolean 'initialize variable
    gotsomething = False

    Set pAnnotation = View.GetFirstAnnotation ' Get the first Annotation in the
    View if any exist

    ' Loop through every Annotation in View
    While (Not pAnnotation Is Nothing) 'If pAnnotation is nothing, then to
    annotation was selected this time
    gotsomething = True 'An annotation was found at pAnnotation.GetNext or
    View.GetFirstAnnotation
    pAnnotation.Select2 True, 0 'Add the gotten annotation to the selection
    list
    If pAnnotation.GetType = swCThread Then 'If annotation is a cosmetic
    thread, then hide it
    Drawing.HideCosmeticThread
    End If
    Set pAnnotation = pAnnotation.GetNext 'Get the next annotation
    Wend

    If gotsomething = True Then
    Drawing.EditDelete 'delete any annotations that may have been selected
    End If

    End Sub
     
    Mark Reimer, Jul 10, 2003
    #6
  7. Ray, this is exactly how we do it too. Seems to work pretty well for me.
     
    Richard Charney, Jul 10, 2003
    #7
  8. SW Monkey

    rocheey Guest

    Ive got the entire process pretty much automated. Yes, the generation
    of flat patterns takes a few minutes, but the overall time is shorter,
    compared to, say, exporting a flat from autocad and then having to
    hunt down the geometry errors. Anyway, I have the code installed as an
    NT service, and it just wanders around the network(s) 24/7 just
    *looking* for something new to unfold <grin>

    I wrote my own DXF exporter, which accesses the geometry directly from
    the view.
    This allows me to ignore all BUT the geometry (no bend lines, datum
    point, center marks, etc) and the scale issue is irrelevant (except
    for translating the default mm API units to inch). I also wrote
    exporters for our sheet metal application formats (Fabriwin .prt files
    and Maker .prt files) so I have the option of exporting directly to
    CAM.

    There are a few issues which I dont see addressed in most sheet metal
    export schemes:

    1) The CreateFlatPatternViewFromModelView API call still returns TRUE
    if the VIEW was successfully created, and not *necessarily* the flat
    pattern. This means that if the part has errors and wont unfold,
    you'll generate nothing but a view of the folded state. I do a rebuild
    on the referenced configuration and check the return for errors first.

    2) If the model has an older style, non-derived flat pattern
    configuration,
    (which isnt linked to a 'folded' config), a call to generate a flat
    pattern view will still use the old config, even on newer installs of
    SW. The features
    on these non-derived flat configs are sometimes not updated with its
    folded view
    and you can then end up exporting the OLD version of the part.

    So generally, I first check to see if the config is derived, and, if
    not, check to see if any special features have been added AFTER the
    flat pattern/process bends feature. If there are none, then Id have
    the code delete this legacy flat config and create a new derived
    config, using the same naming scheme.
     
    rocheey, Jul 11, 2003
    #8
  9. SW Monkey

    rocheey Guest

    We have been using Fabriwin for our NC for a Plasma Machine which I
    I use fabriwin myself, but for a laser. While Ive seen some
    proprietary Plasma formats, normally G-Code can be very standard.


    Yes, well, I avoid that at all costs. First off, it fails if the part
    has a Flat Pattern feature instead of the 'process bends' feature.
    Secondly, fabriwin
    only uses single-precision decimals internally in its format, and on
    slight angles and/or non-quadrant arcs, the floating point returns
    round off errors that create failures in nesting/common cutting, at
    least when using the higher-precision needed for laser.
     
    rocheey, Jul 11, 2003
    #9
  10. SW Monkey

    Mark Reimer Guest

    This would happen if you did not include swConst.bas in the project because
    swDocDRAWING is defined as 3 in there and would be 0 otherwise. You can
    replace swDocDRAWING with 3, in the original code, but there are several
    other constants that I used from swConst.bas, so the program will still not
    work unless you were to search for all of them and replace them with the
    numbered values found there.

    The easiest way to make this work is while in the VB editor editing this
    macro, select File, Import File from the main menu and browse for
    swConst.bas. It should be found in the SolidWorks\samples\appComm folder.

    If you did already import it then I'm not sure what the problem is, but I
    will resend the original macro to you again at your newer address before it
    also expires.

    --Mark
     
    Mark Reimer, Jul 11, 2003
    #10
  11. SW Monkey

    Davis Guest

    When we used Fabriwin, there was often geometry error - particularly
    in filleted corners - that left open geometry and required repair. You
    had to add the cut before you'de see the errors, though, and then go
    back and fix them. Often if you missed an error there would be gaps in
    the g-code. BTW, I hate Fabriwin for lots of other reasons.

    We're now primarly using N-cell for nesting. This also requires clean
    dxf's for the tool path.

    I do a saveas from my SW drawing, highlighting the flat pattern view.
    First turn off sketches, so the bend lines disappear. In the saveas
    dialog, select dxf, then go to options to set the scale to 1:1.

    Then I load the file into Autocad LT, copy and move the flat view, cut
    the rest of the drawing, and double check that the scale is correct.

    This sounds like a lot of work, but probably only takes 15 seconds.
    We've done hundreds this way since changing to Ncell, with almost no
    trouble.
     
    Davis, Jul 11, 2003
    #11
  12. SW Monkey

    SW Monkey Guest

    If you just do a "Hide Sketches" in the pull-down menu, it doesnt
    truly hide the bend line, you can see this by moving your mouse over
    where the bend line should be. Marks macro hides this though, works
    great.
    Why not just delete the titleblock inside of SolidWorks? This would
    save you from opening it in Autocad.
    The procedure we use doesnt take that long either, about 10-15
    seconds, but the more steps you have to do, the greater the chance of
    an error. Checkout Marks macro he posted. It looks like it works
    very well.
     
    SW Monkey, Jul 14, 2003
    #12
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.