Using the sample code below, how do I show the bend lines on the drawing view?
Thanks in advance, Dave
Public Sub AddFlatPatternDrawingView() ' Set a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument 'Set a reference to the active sheet. Dim oSheet As Sheet Set oSheet = oDrawDoc.ActiveSheet ' Create a new NameValueMap object Dim oBaseViewOptions As NameValueMap Set oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap ' Set the options to use when creating the base view. Call oBaseViewOptions.Add("SheetMetalFoldedModel", False) ' Open the sheet metal document invisibly Dim oModel As Document Set oModel = ThisApplication.Documents.Open("C:\temp\SheetMetal.ipt", False) ' Create the placement point object. Dim oPoint As Point2d Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(25, 25) ' Create a base view. Dim oBaseView As DrawingView Set oBaseView = oSheet.DrawingViews.AddBaseView(oModel, oPoint, 1, _ kDefaultViewOrientation, kHiddenLineRemovedDrawingViewStyle, _ , , oBaseViewOptions) End Sub
Hi Dave,
I think the best thing is always to try things in the UI and then examine the result in VBA Watches window:
http://adndevblog.typepad.com/manufacturing/2013/10/discover-object-model.html
I assume you mean the "Bend Extents" option of the DrawingView. That only seems to be available when you place a Flat Pattern - you are placing a Folded Model:
If the option is available then it can be set using DrawingView.DisplayBendExtents
Cheers,
Hi,
I would like to place a base view of folded model.
' Set the options to use when creating the base view.
Call oBaseViewOptions.Add("SheetMetalFoldedModel", True)
I have tried this, but with no succes.
Can anybody tel me how to create the folded model, isometric view.
Thank you!
1. This is an old post. Please make a new post instead of reviving old threads.
2. What isn't working about it? Where is the full section of code to see what you are doing wrong? That single line you typed looks just fine. How it's used in the larger program may be a different story.
Hi @o.sassen,
I tried the following sample VBA code with attached part. Before running this code, make sure that a drawing document is opened in Inventor 2018.
Public Sub AddFlatPatternDrawingView() ' Set a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument 'Set a reference to the active sheet. Dim oSheet As Sheet Set oSheet = oDrawDoc.ActiveSheet ' Create a new NameValueMap object Dim oBaseViewOptions As NameValueMap Set oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap ' Set the options to use when creating the base view. Call oBaseViewOptions.Add("SheetMetalFoldedModel", True) ' Open the sheet metal document invisibly Dim oModel As Document Set oModel = ThisApplication.Documents.Open("Path of file\Mounting Bracket.ipt", False) ' Create the placement point object. Dim oPoint As Point2d Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(25, 25) ' Create a base view. Dim oBaseView As DrawingView Set oBaseView = oSheet.DrawingViews.AddBaseView(oModel, oPoint, 1, _ kDefaultViewOrientation, kHiddenLineRemovedDrawingViewStyle, _ , , oBaseViewOptions) End Sub
In the above code, path of file need to update after downloading attached part.
Please feel free to contact if there is any queries.
Thanks and regards,
Yes it's is working, but I don't understand why. What dit you change? The only difference is the true or false statement. But when I change this in my code it's not working.
This is what I tried:
Public Sub AddFlatPatternDrawingView()
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
'Set a reference to the active sheet.
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
' Create a new NameValueMap obja jject
Dim oBaseViewOptions As NameValueMap
Set oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Set the options to use when creating the base view.
Call oBaseViewOptions.Add("SheetMetalFoldedModel", False)
Run-time error '5':
"Invallid procedure call or argument"
' Open the sheet metal document invisibly
Dim oModel As Document
Set oModel = ThisApplication.Documents.Open("C:\Vault\Designs\Klimaat\Projecten\Norby\CO2 Collector\part1.ipt", False)
' Create the placement point object.
Dim oPoint As Point2d
Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(6, 20)
' Create a base view.
Dim oBaseView As DrawingView
Set oBaseView = oSheet.DrawingViews.AddBaseView(oModel, oPoint, 1 / 25, kIsoTopRightViewOrientation, kShadedDrawingViewStyle, _
, , oBaseViewOptions)
' Set oBaseView = oSheet.DrawingViews.AddBaseView(oModel, oPoint, 1 / 25, _
' kFlatBacksidePivotLeftViewOrientation, kHiddenLineRemovedDrawingViewStyle, _
' , , oBaseViewOptions)
End Sub
Oh sorry all, I already know what was wrong. I was using a wrong view.
Case closed. It's is working perfectly now!
Hi,
maybe like this?:
Public Sub AddFlatPatternDrawingView()
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
'Set a reference to the active sheet.
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
' Create a new NameValueMap object
Dim oBaseViewOptions As NameValueMap
Set oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Set the options to use when creating the base view.
Call oBaseViewOptions.Add("SheetMetalFoldedModel", False)
' Open the sheet metal document invisibly
Dim oModel As Document
Set oModel = ThisApplication.Documents.Open("C:\temp\SheetMetal.ipt", False)
' Create the placement point object.
Dim oPoint As Point2d
Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(25, 25)
' Create a base view.
Dim oBaseView As DrawingView
Set oBaseView = oSheet.DrawingViews.AddBaseView(oModel, oPoint, 1, _
kDefaultViewOrientation, kHiddenLineRemovedDrawingViewStyle, _
, , oBaseViewOptions)
Dim oDwgCurve As DrawingCurve
For Each oDwgCurve In oBaseView.DrawingCurves
If oDwgCurve.EdgeType = kBendDownEdge Then
oDwgCurve.Segments.Item(1).Visible = False
End If
Next
End Sub
Can't find what you're looking for? Ask the community or share your knowledge.