Script to change all dimensions to projected

Script to change all dimensions to projected

anthony_hendrick
Advocate Advocate
494 Views
2 Replies
Message 1 of 3

Script to change all dimensions to projected

anthony_hendrick
Advocate
Advocate

I am currently experiencing a similar problem [to this one] with my dimensions. 

[Post moved to new thread, title & body modified to link to old conversation. By CGBenner 3/26/24]

 

I have en elevation for which i want to show projected dimensions. They were shown as true dimensions, which is very dangerous for us as it essentially showed a number of incorrect dimensions. 

 

My question is, could a script be created to change all dimensions to projected? 

 

I prefer to always use projected dimensions. I do not use dimensions in my isometric views. 

 

thanks

 

regards

anthony

0 Likes
495 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @anthony_hendrick.  [post edited by CGBenner 3/26/24] I looked into your question before.  We have a way to 'check' if a GeneralDimension is either 'True' or 'Projected', but that property is ReadOnly, so we can not change its value.  And there is no 'method' available to the GeneralDimension object for changing it either.  There is a 'command' (ControlDefinition) named "DrawingViewDimTypeProjectedCtxCmd" that you may be able to work with (Execute) though.  I have not tried using it before, but it sounds like it may be something that would require an entire DrawingView object be selected before applying it, not necessarily for being applied to individual GeneralDimension objects...but not sure.

GeneralDimension.GeneralDimensionType 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

WCrihfield
Mentor
Mentor

Hi @anthony_hendrick.  On second look at this, even though there does not appear to be a property of each individual GeneralDimension object for changing its type between true and projected, I think I now see another way to accomplish what you want.  It appears that manually, then we select a drawing view, we have an option within our right-click menu for changing that view's general dimensions type between true and projected.  That gave me the clue I needed on where to find the setting we were looking for, and it looks like it will be simpler than I thought (no selections or command execution needed).

 

However, there were valid arguments as to why these dimensions are the types they are by default in certain situations, as mentioned in the link within your original post.

 

Give this following iLogic rule a try.

 

Sub Main
	Dim oDDoc As DrawingDocument = TryCast(ThisDoc.Document, Inventor.DrawingDocument)
	If oDDoc Is Nothing Then Logger.Debug(iLogicVb.RuleName & " exited (wrong DocumentType)") : Return
	Dim oSheets As Inventor.Sheets = oDDoc.Sheets
	For Each oSheet As Inventor.Sheet In oSheets
		Dim oViews As DrawingViews = oSheet.DrawingViews
		If oViews.Count = 0 Then Continue For
		For Each oView As DrawingView In oViews
			If oView.GeneralDimensionType = GeneralDimensionTypeEnum.kTrueGeneralDimension Then
				oView.GeneralDimensionType = GeneralDimensionTypeEnum.kProjectedGeneralDimension
			End If
		Next 'oView
	Next 'oSheet
End Sub

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes