Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
C_Haines_ENG
342 Views, 6 Replies

Determine if Dimension with Text is Horizontal Or Vertical

I have a "Duplicate Post" on here already but Ive run into an issue with some code. 

 

oObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "Select a drawing dimension.")

	If oObj.DimensionType = DimensionTypeEnum.kHorizontalDimensionType Then
		MsgBox("Horizontal", , "")
	ElseIf oObj.DimensionType = DimensionTypeEnum.kVerticalDimensionType Then
		MsgBox("Vertical", , "")
	Else
		MsgBox("Other", , "")
	End If

I am trying to find if a dimension that contains text is either vertical or horizontal. The above code works on dimensions that do not have text but I need to find this value for values that have text.  

tyler.warner
in reply to: C_Haines_ENG

What do you mean by "contains text" or "have text" ?

 

It seems to work even on dims that have additional text added to the number. 

 

Can you provide an example file?

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
C_Haines_ENG
in reply to: tyler.warner

I mean dimensions that have manuallally overridden text, i have attached an example document below.

 

I have double clicked on these dimensions and added the word "PANEL" to them, my program will eventually find the orientation of the two dimensions that have the word "PANEL" in them.

tyler.warner
in reply to: C_Haines_ENG

The dimension type from the command manager pick function should not matter whether there is no text, additional text or over-ridden text.

 

The issue you'll get with the above workflow is it will depend on how you created your dimensions. To get a "horizontal" or "vertical" dimension type, it will require two "points" to be picked. If two "lines" are picked, it will be the "aligned" dimension type.

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
C_Haines_ENG
in reply to: tyler.warner

Is it possible to get a vertical or horiztonal result from an aligned dimension?

tyler.warner
in reply to: C_Haines_ENG

You can see if this works for you. (Reference Link) 

 

If TypeOf oObj.DimensionLine Is LineSegment2d Then
'	MsgBox(oObj.DimensionLine.Direction.X)
'	MsgBox(oObj.DimensionLine.Direction.Y)
	If oObj.DimensionLine.Direction.X = 1 Then
		MsgBox("Dimension is Horizontal.")
	Else If oObj.DimensionLine.Direction.Y = -1 Then
		MsgBox("Dimension is Vertical.")
	End If
End If

 

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
C_Haines_ENG
in reply to: tyler.warner

Great! That works Perfectly!