How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
Hi All,
I have been looking for an answer for this problem, but seem to be getting nowhere. I have a drawing that contains multiple Views of derived parts from the same Assembly, but will change in length.
I have found a way to automatically dimension specific entities within the part, and this works flawlessly for one view:
Dim oDrawingDoc As DrawingDocument oDoc = ThisApplication.ActiveDocument For Each oSheet In oDoc.Sheets For Each oView In oSheet.DrawingViews Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1") Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1") Dim namedGeometry1 = VIEW1.GetIntent("Bottom") Dim namedGeometry2 = VIEW1.GetIntent("TOP") Dim genDims = Sheet_1.DrawingDimensions.GeneralDimensions Dim linDim1 = genDims.AddLinear("Dimension 1", VIEW1.SheetPoint(0, -0.1), namedGeometry1) Dim linDim2 = genDims.AddLinear("Dimension 2", VIEW1.SheetPoint(-0.1, 0), namedGeometry1, namedGeometry2) Next oView Next oSheet
However, I want to be able to add a few more Entities, so I can create multiple dimensions for all the views in the drawing, which could be anywhere between 5 - 30 Views.
I think I'm almost there, but how would I create a loop to go through each View, and find the same entity names for each part and dimension them the same way?
Also, If you can find a way, some dimensions are required to be in a different dimension style, which again will be the same for each view.
Thanks!
Solved! Go to Solution.
@ryan.blake447QH
Hello and welcome. I've moved your post here for greater visibility with the programming community. Thank you!
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
Are you able to give us some examples (screenshots) of what kinds of views you are trying to dimension, and what kinds of dimensions you are trying to add? It sounds to me like you may be trying to make an automated cut list drawing with a front view showing the cut length, and a side view showing the part profile, is this similar to what you are trying to achieve? If this is the case and the views are added systematically I've had luck using a function checking to see if the view number ended in an even or odd number, and applying different dimensions based on that result.
Hi @ryan.blake447QH, you could do something like this I think.
Hope that helps,
Curtis
Dim oDoc As DrawingDocument = ThisDrawing.Document For Each oSheet As Sheet In oDoc.Sheets For Each oView As DrawingView In oSheet.DrawingViews Dim MySheet = ThisDrawing.Sheets.ItemByName(oSheet.Name) Dim MyView = MySheet.DrawingViews.ItemByName(oView.Name) Dim genDims = MySheet.DrawingDimensions.GeneralDimensions Dim namedGeometry1 As GeometryIntent = Nothing Dim namedGeometry2 As GeometryIntent = Nothing Try : namedGeometry1 = MyView.GetIntent("Bottom") : Catch : End Try Try : namedGeometry2 = MyView.GetIntent("TOP") : Catch : End Try If oSheetname = "Sheet1" And oView.Name = "VIEW1" Then If namedGeometry1 Is Nothing Then Continue For genDims.AddLinear("Dim1 " & oSheetname & oView.Name, MyView.SheetPoint(0, -0.1), namedGeometry1) If namedGeometry2 Is Nothing Then Continue For genDims.AddLinear("Dim2 " & oSheetname & oView.Name, MyView.SheetPoint(-0.1, 0), namedGeometry1, namedGeometry2) End If Next oView Next oSheet
Thanks for that @Curtis_Waguespack, with a few tweaks I was able to get it to work and I have added a few more Points to test it:
Dim oDrawingDoc As DrawingDocument oDoc = ThisApplication.ActiveDocument i = 1 For Each oSheet As Sheet In oDoc.Sheets For Each oView As DrawingView In oSheet.DrawingViews Dim MySheet = ThisDrawing.Sheets.ItemByName(oSheet.Name) Dim MyView = MySheet.DrawingViews.ItemByName(oView.Name) Dim genDims = MySheet.DrawingDimensions.GeneralDimensions Dim namedGeometry1 As GeometryIntent = Nothing Dim namedGeometry2 As GeometryIntent = Nothing Dim namedGeometry3 As GeometryIntent = Nothing Dim namedGeometry4 As GeometryIntent = Nothing Try : namedGeometry1 = MyView.GetIntent("Bottom") : Catch : End Try Try : namedGeometry2 = MyView.GetIntent("TOP") : Catch : End Try Try : namedGeometry3 = MyView.GetIntent("WP3") : Catch : End Try Try : namedGeometry4 = MyView.GetIntent("WP4") : Catch : End Try If oSheet.Name = "Sheet:1" And oView.Name = "VIEW" & i Then If namedGeometry1 Is Nothing Then Continue For genDims.AddLinear("Dim1 " & oSheetname & oView.Name, MyView.SheetPoint(0, -0.1), namedGeometry1) If namedGeometry2 Is Nothing Then Continue For genDims.AddLinear("Dim2 " & oSheetname & oView.Name, MyView.SheetPoint(-0.1, 0), namedGeometry1, namedGeometry2) If namedGeometry3 Is Nothing And namedGeometry4 Is Nothing Then Continue For genDims.AddLinear("Dim3 " & oSheetname & oView.Name, MyView.SheetPoint(-0.1, 0), namedGeometry3, namedGeometry4) End If i = i + 1 Next oView Next oSheet
If you know how to change the dimension style, as some dimensions require different styles, that would be everything I need!
How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
Type a product name