Sheet Metal - API for Flat Pattern View in Drawing
Sheet Metal - API for Flat Pattern View in Drawing
(OP)
I'm looking for an API function that can look at the Bend Line notes on a sheet metal part in a drawing. If the part is Face-Down, the macro will flip the part to Face-Up. This would work in the same way as when you click "Flip View" in the Flat Pattern Options while in a Drawing View of a sheet metal part.
I haven't been able to find anything on this, can anyone help me out?
Thanks!
I haven't been able to find anything on this, can anyone help me out?
Thanks!
Shawn Oelschlager
Production Control Ass't
Transco Products Inc.
http://www.transcoproducts.com
SolidWorks Office Premium 2006 - SP4.1
Pentium 4 (2.8 GHz) - 2GB RAM






RE: Sheet Metal - API for Flat Pattern View in Drawing
RE: Sheet Metal - API for Flat Pattern View in Drawing
Shawn Oelschlager
Production Control Ass't
Transco Products Inc.
http://www.transcoproducts.com
SolidWorks Office Premium 2006 - SP4.1
Pentium 4 (2.8 GHz) - 2GB RAM
RE: Sheet Metal - API for Flat Pattern View in Drawing
If a part has one bend up and one bend down, which one wins?
RE: Sheet Metal - API for Flat Pattern View in Drawing
Shawn Oelschlager
Production Control Ass't
Transco Products Inc.
http://www.transcoproducts.com
SolidWorks Office Premium 2006 - SP4.1
Pentium 4 (2.8 GHz) - 2GB RAM
RE: Sheet Metal - API for Flat Pattern View in Drawing
RE: Sheet Metal - API for Flat Pattern View in Drawing
Sorry about that, I did miss your point. That's a very good question. Like I said, I'm helping a co-worker (who happens to be out of the office today) so I'll have to ask him when he returns. I'm not sure if we'll have that situation, but I think we determine "Face Up" by the Bend Line notes. I'm not even sure whether the Bend Line notes are actually noting the direction of the bends, or if they're just a label chosen by the designer at an earlier stage. Can you tell me which is the case?
Shawn Oelschlager
Production Control Ass't
Transco Products Inc.
http://www.transcoproducts.com
SolidWorks Office Premium 2006 - SP4.1
Pentium 4 (2.8 GHz) - 2GB RAM
RE: Sheet Metal - API for Flat Pattern View in Drawing
There is also an API call for the drawing -
CreateFlatPatternViewFromModelView2
That will automatically create a flat pattern view on the drawing (in the correct orientation).
I'm not aware of any API functionality to read an existing view and flip the orientation...
CorBlimey - in our shop the press operators always want bend up instead of bend down so they can scribe the part on the bend up side (the side that the press contacts) with dimensions as indicated on the drawing - on parts that are bend up and bend down you usually put the side with more bends as "up".
RE: Sheet Metal - API for Flat Pattern View in Drawing
I've seen the API call to determine the "Fixed Face" of a part, but I'm not sure how to use it. There's some argument that I need to pass to it or something, but I'm not sure what. The SW API Help doesn't show much, but here's what I have so far...
CODE
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swSelData As SldWorks.SelectData
Dim swFeat As SldWorks.Feature
Dim swSheetMetal As SldWorks.SheetMetalFeatureData
Dim swFixedFaceEnt As SldWorks.Entity
Dim bRet As Boolean
Dim swFlatPattern As SldWorks.FlatPatternFeatureData
Dim strFlat As String
Dim FeatureCount As Long
Dim FeatureName As String
Dim FeatureType As String
Dim i As Integer
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swSelData = swSelMgr.CreateSelectData
Set swFeat = swSelMgr.GetSelectedObject5(1)
'Set swSheetMetal = swFeat.GetDefinition
FeatureCount = swModel.GetFeatureCount
For i = 0 To FeatureCount
FeatureName = swFeat.Name
FeatureType = swFeat.GetTypeName
If FeatureType = "FlatPattern" Then
Set swFlatPattern = swFeat.GetDefinition
strFlat = swFlatPattern.FixedFace
End If
Set swFeat = swFeat.GetNextFeature
Next i
' Roll back the model to get access to fixed face
bRet = swSheetMetal.AccessSelections(swModel, Nothing)
Set swFixedFaceEnt = swSheetMetal.FixedReference
If Not swFixedFaceEnt Is Nothing Then
Debug.Print "Got fixed face or fixed edge"
bRet = swFixedFaceEnt.Select4(False, swSelData): Debug.Assert bRet
Else
' Do not have to specify fixed face or fixed edge in user interface,
' so NULL is a valid value
Debug.Print "NULL fixed face or fixed edge"
End If
' Cancel changes and roll back the model
swSheetMetal.ReleaseSelectionAccess
End Sub
Where I have
CODE
I'm trying to determine the Fixed Face but I'm getting "Error 91 - Object variable or With Variable not Set"
Can you tell me what I'm missing?
Shawn Oelschlager
Production Control Ass't
Transco Products Inc.
http://www.transcoproducts.com
SolidWorks Office Premium 2006 - SP4.1
Pentium 4 (2.8 GHz) - 2GB RAM
RE: Sheet Metal - API for Flat Pattern View in Drawing
I believe strFlat should be an object not a string variable.
SA
RE: Sheet Metal - API for Flat Pattern View in Drawing
I would love a command that would Flip View of a sheet metal part.
RE: Sheet Metal - API for Flat Pattern View in Drawing
Shawn Oelschlager
Production Control Ass't
Transco Products Inc.
http://www.transcoproducts.com
SolidWorks Office Premium 2006 - SP4.1
Pentium 4 (2.8 GHz) - 2GB RAM