iLogic to Create Drawing with Flat Pattern View

kara_johnsonLG2ZG
Explorer

iLogic to Create Drawing with Flat Pattern View

kara_johnsonLG2ZG
Explorer
Explorer
Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDoc.ComponentDefinition
If oCompDef.HasFlatPattern = False Then
	MessageBox.Show("Please create flat pattern")
	Exit Sub
End If

Dim oDrawingDoc As DrawingDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject,templateFile,True)

oDrawingDoc.Activate()
Dim oSheet As Sheet = oDrawingDoc.Sheets.Item(1)

Dim oView1, oView2, oView3 As DrawingView
Dim oTopRightPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width * 2 / 3, oSheet.Height * 2 / 3)
Dim oLeftPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width / 3, oSheet.Height / 2)

oView1 = oSheet.DrawingViews.AddBaseView(oDoc, oTopRightPoint, 1/8, ViewOrientationTypeEnum.kIsoTopRightViewOrientation, DrawingViewStyleEnum.kShadedDrawingViewStyle)
oView2 = oSheet.DrawingViews.AddBaseView(oDoc, oTopRightPoint, 1/8, ViewOrientationTypeEnum.kFlatBacksideViewOrientation, DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle)
Dim oProjectedPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oView2.Center.X, oView2.Center.Y -10)
oView3 = oSheet.DrawingViews.AddProjectedView(oView2, oProjectedPoint, DrawingViewStyleEnum.kFromBaseDrawingViewStyle)

I am creating an iLogic rule to automatically create drawings and place a couple of views. We are working with sheet metal and I would like to place a flat view. However, when I run my code, it says "the parameter is incorrect". I've narrowed this down to being the flat view orientation parameter (the red text). 

 

The ipt does have a flat pattern (and I also check if it has one in the code). If I try and edit the view that it does place (Iso Top Right), the flat pattern bubble is greyed out. But if I manually create a new base view, I can select flat pattern. 

 

Any ideas what I'm doing wrong?

0 Likes
Reply
Accepted solutions (1)
98 Views
3 Replies
Replies (3)

CGBenner
Community Manager
Community Manager

@kara_johnsonLG2ZG 

Welcome to the Community!  I moved your post here because this is where all of the programmers hang out.  Good luck!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Industry Community Manager – Design & Manufacturing

patrick.schlambHPACQ
Explorer
Explorer
Accepted solution

Dim oViewOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
oViewOptions.Add("SheetMetalFoldedModel", False)
oView2 = oSheet.DrawingViews.AddBaseView(oDoc, oTopRightPoint, 1/8, ViewOrientationTypeEnum.kBackViewOrientation, DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle, AdditionalOptions := oViewOptions)
'oView2
= oSheet.DrawingViews.AddBaseView(oDoc, oTopRightPoint, 1/8, ViewOrientationTypeEnum.kFlatBacksideViewOrientation, DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle)
 

 I have commented out your line and replaced it with a line I have used to successfully create flat pattern views in a drawing. I tried to match it to your existing code and variable, but may have missed something. Please let me know if this helps with your issue. 

 

kara_johnsonLG2ZG
Explorer
Explorer

Worked! Thank you so much for your help!

Type a product name