Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Drawing automation, new drawing file name as "partnumber.idw"

torok.zoltan55
Community Visitor

Drawing automation, new drawing file name as "partnumber.idw"

torok.zoltan55
Community Visitor
Community Visitor

Hi,

I want to create an idw file with iLogic rule, from part file.  I want to  create a new idw from part, and name the idw file as PART NUMBER from iProperties. For example there is a part: name= clutch, part number= DA2001. And I want to create an idw file as name: "DA2001.idw". This way I can automate the drawing process a bit.

0 Likes
Reply
204 Views
1 Reply
Reply (1)

A.Acheson
Mentor
Mentor

Here is a quick sample. It has drawing creation, view placement, and saving. 

 

Dim DWGcreate As String = MsgBox ("Would You Like To Create A Drawing From This Part?" & vbLf & vbLf & "This Will Create a Base, Side & ISO View", vbYesNo, "Drawing Creation")

If DWGcreate = vbYes Then
Else
	Return
End If

Dim PartDoc As PartDocument = ThisDoc.Document
Dim TemplatePath As String = "Enter the file path of your template"
'No Template path provided.
Dim DrawingDoc As DrawingDocument = ThisApplication.Documents.Add(kDrawingDocumentObject, , True)
'Dim DrawingDoc As DrawingDocument = ThisApplication.Documents.Add(kDrawingDocumentObject,TemplatePath , True)
DrawingDoc.Activate()

Dim ActiveSheet As Sheet = DrawingDoc.ActiveSheet

Dim Scale As Double
'Scale Choices.
Dim ScaleList As New List (Of String)
ScaleList.Add("1/40")
ScaleList.Add("1/30")
ScaleList.Add("1/20")

Dim ScaleSel As String  = InputListBox("Select one:", ScaleList, "", "iLogic", "Scale Choices")

If ScaleSel = "1/40" Then
	Scale = 0.025
ElseIf ScaleSel = "1/30" Then
	Scale = 0.0333333333
ElseIf ScaleSel = "1/20" Then
	Scale = 0.05
End If

Dim TG As TransientGeometry = ThisApplication.TransientGeometry

Dim Point1 As Point2d = TG.CreatePoint2d (12,15)
Dim BaseView As DrawingView =  ActiveSheet.DrawingViews.AddBaseView(PartDoc, Point1, Scale, ViewOrientationTypeEnum.kTopViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)

Dim Point2 As Point2d = TG.CreatePoint2d(25, 15)
Dim RightView As DrawingView =  ActiveSheet.DrawingViews.AddProjectedView(BaseView,Point2,DrawingViewStyleEnum.kFromBaseDrawingViewStyle)

Dim Point3 As Point2d = TG.CreatePoint2d(35, 22)
Dim IsoView As DrawingView =  ActiveSheet.DrawingViews.AddProjectedView(BaseView,Point3,DrawingViewStyleEnum.kShadedDrawingViewStyle)

Dim DrawingName As String  = ThisDoc.Path & "\" & PartDoc.PropertySets.Item(3).Item("Part Number").Value & ".idw"
DrawingDoc.SaveAs(DrawingName,False)

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes