iLogic to Create Drawing with Flat Pattern View

iLogic to Create Drawing with Flat Pattern View

kara_johnsonLG2ZG
Explorer Explorer
1,626 Views
5 Replies
Message 1 of 6

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
Accepted solutions (1)
1,627 Views
5 Replies
Replies (5)
Message 2 of 6

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

Community Manager - NAMER / D&M


Message 3 of 6

patrick.schlambHPACQ
Participant
Participant
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. 

 

Message 4 of 6

kara_johnsonLG2ZG
Explorer
Explorer

Worked! Thank you so much for your help!

Message 5 of 6

AkshayM9WQXB
Explorer
Explorer

I tried your code but I'm getting an error as

"Rule Compile Errors in Rule Temp 2, in P1.ipt

Error on Line 2 : 'oDoc' is not declared. It may be inaccessible due to its protection level." Why is that? I need to do same, to place flat pattern, and have section views for that folded part by placing the folded part over the flat pattern and an Iso view. Could you please help me with this? Thank you.

0 Likes
Message 6 of 6

AkshayM9WQXB
Explorer
Explorer

I have also attached the dwg file so you have an idea on what I am looking for. I want something like that. The folded part which is sectioned is place on the flat pattern and then it is suppressed after having section views so we only are left with flat pattern, section views and ISO view. Thank you.

0 Likes