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

Determine if Dimension with Text is Horizontal Or Vertical

C_Haines_ENG
Collaborator

Determine if Dimension with Text is Horizontal Or Vertical

C_Haines_ENG
Collaborator
Collaborator

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.  

0 Likes
Reply
Accepted solutions (1)
342 Views
6 Replies
Replies (6)

tyler.warner
Advocate
Advocate

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.
0 Likes

C_Haines_ENG
Collaborator
Collaborator

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.

0 Likes

tyler.warner
Advocate
Advocate

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.
0 Likes

C_Haines_ENG
Collaborator
Collaborator

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

0 Likes

tyler.warner
Advocate
Advocate
Accepted solution

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.
0 Likes

C_Haines_ENG
Collaborator
Collaborator

Great! That works Perfectly!

0 Likes