how to fix the position of dimensions.

how to fix the position of dimensions.

JonnyPot
Advocate Advocate
2,923 Views
7 Replies
Message 1 of 8

how to fix the position of dimensions.

JonnyPot
Advocate
Advocate

hello. I am looking to lock the position of the dimensions in drawings so that when i run a Macros or iLogic rules the dimension does not overlap the drawings lines, i was thinking to block them in the premade middle positions already in inventor, shown in the video. Any other solutions are welcome.

0 Likes
Accepted solutions (2)
2,924 Views
7 Replies
Replies (7)
Message 2 of 8

dutt.thakar
Collaborator
Collaborator
Accepted solution

@JonnyPot 

 

To fix the position of Dimensions in a drawing, you can use Point2D object, which works something like this.

 

See below code, for an example only, it wont be applicable in your drawing you need to tweak the code to suit your requirement.

 

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)
Dim oPartDoc As PartDocument = ActiveSheet.View("VIEW1").ModelDocument
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry

'===This is where we are defining an arbitrary position as X and Y Cordinates, in cm. and the origin point is from bottom left corner of the sheet (i.e. 0,0)

Dim oPt As Point2d = oTG.CreatePoint2d(40, 55)

'========= Now we will use oPt to define the position of the dimension when we give linear dimension... ===================

Dim oLD as LinearGeneralDimension = oSheet.DrawingDimensions.GeneralDimensions.Add(oPt, GemometryIntent1, GeometryIntent2)

'You can also tweak the values in oPt where currently 40 & 55 are give, you can set an equation as well based on your view size and sheet size.
'In above line of code for dimension, make sure you first define your geometry intent to create a dimension

oLD.CenterText '= this line will always keep the dimension text in center.

 

 I hope this has answered your question.  In case you need further clarification, please reply to this thread.

 

Please also, accept this as solution, if this has answered your question.

 

Regards,

Dutt Thakar

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
Message 3 of 8

JhoelForshav
Mentor
Mentor

@JonnyPot 

Maybe a simple DrawingDimensions.Arrange is enough? Try this iLogic rule 🙂

Dim oDimensions As DrawingDimensions = ActiveSheet.Sheet.DrawingDimensions
Dim oCol As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
For Each oDim As DrawingDimension In oDimensions
	oCol.Add(oDim)
Next
oDimensions.Arrange(oCol)
Message 4 of 8

JonnyPot
Advocate
Advocate

@dutt.thakar 

When i try to run it it gives me this erro.

JonnyPot_0-1607361331972.png

 

0 Likes
Message 5 of 8

JonnyPot
Advocate
Advocate

@JhoelForshav

 

Can you also centr it ? 😊  

0 Likes
Message 6 of 8

JhoelForshav
Mentor
Mentor
Accepted solution

@JonnyPot 

Dim oDimensions As DrawingDimensions = ActiveSheet.Sheet.DrawingDimensions
Dim oCol As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
For Each oDim As DrawingDimension In oDimensions
	oCol.Add(oDim)
Next
oDimensions.Arrange(oCol)
For Each oDim As DrawingDimension In oCol
	On Error Resume Next
	oDim.CenterText
Next
Message 7 of 8

murugasubi
Enthusiast
Enthusiast

 

@JhoelForshav@dutt.thakar@JonnyPot 

 

Thank you all, it's working well, but in my view, the value is coming very close.  Can we slightly increase the distance from the view as shown below?

 

murugasubi_1-1647874821614.png

 

Thanks in advance.

 

0 Likes
Message 8 of 8

m.den.ouden
Advocate
Advocate

Sure Increase all workplanes (same size) that are corresponding to that view. Cause if the workplane is bigger then your 3d object the red dot line is getting bigger to. And the arrangedimensions function is actually putting all the dimensions outside the red dot line. show'n in the image below

 

mdenouden_0-1663160558785.png

 

0 Likes