dogarila
Mechanical
- Oct 28, 2001
- 594
We are using mainly sheet metal parts to build our machines. Our laser machine program accepts only dxf drawings. I am looking at ways to speed up a little bit the generation of flat patterns for our models.
1. One problem I have right know is how to control which face SW will show when creating a flat pattern view. I need to have the flat shown with the paper side (finish side) up. There is no way to specify in the model which side is the finished one. How does SW select which face is up when generating a flat pattern?
2. I found this piece of code in SW Help to generate a flat pattern view in a new drawing. I changed the sheet size to A size and the template name with my A size template. The problem I have is that the flat pattern view is bigger than my template. I know how to change the sheet scale. My question is how do I change the sheet scale so the flat view will fit the sheet? Based on the size of the model my sheet scale could be 1:1, 1:2, 1:4, 1:8, 1:16 or 2:1, 4:1, etc.
1. One problem I have right know is how to control which face SW will show when creating a flat pattern view. I need to have the flat shown with the paper side (finish side) up. There is no way to specify in the model which side is the finished one. How does SW select which face is up when generating a flat pattern?
2. I found this piece of code in SW Help to generate a flat pattern view in a new drawing. I changed the sheet size to A size and the template name with my A size template. The problem I have is that the flat pattern view is bigger than my template. I know how to change the sheet scale. My question is how do I change the sheet scale so the flat view will fit the sheet? Based on the size of the model my sheet scale could be 1:1, 1:2, 1:4, 1:8, 1:16 or 2:1, 4:1, etc.
Code:
Option Explicit
' Paper size in millimeters
' A 216 x 279
' B 279 x 432
' C 432 x 559
' D 559 x 864
' E 864 x 1118
'
' A0 841 x 1189
' A1 594 x 841
' A2 420 x 594
' A3 297 x 420
' A4 210 x 297
Const TemplateSize As Long = 1
Const PaperSize As Long = 1
Const PaperWidth As Double = 0.216 ' Meters
Const PaperHeight As Double = 0.279 ' Meters
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim bRet As Boolean
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
Set swDraw = swApp.NewDrawing2(TemplateSize, "G:\Working\SolidWorks Data\Templates\Drawings\A_LaserX.DRWDOT", PaperSize, PaperWidth, PaperHeight)
Set swView = swDraw.CreateFlatPatternViewFromModelView3(swModel.GetPathName, "", PaperWidth / 2, PaperHeight / 2, 0#, False, False)
Debug.Print swView.GetName2
Debug.Print swView.FlipView
swView.FlipView = False
' Debug.Print swView.FlipView
End Sub