Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Moving a dimension to a position outside the arrow with ilogic

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
heliston_guimaraes
252 Views, 5 Replies

Moving a dimension to a position outside the arrow with ilogic

Hello everyone,
I created a dimension with ilogic. However, the dimension always appears centered, regardless of whether the arrows are inwards or outwards. How do I move a dimension to a position outside the arrow with ilogic?
I attach two images: one with the dimension centered and how the program creates it and the other with the dimension as I would like it to be created.

Thank you to anyone who can take the time to help.

 

 

 

Dim cotaCcomprimento_SF = genDims_SF.AddLinear("cotaCcomprimento_SF", VIEW01_SF.SheetPoint(DistCotaComprY + .1, + DistCotaComprX), diam1_SF, profcsliso_SF, DimensionTypeEnum.kVerticalDimensionType,) 
cotaCcomprimento_SF.NativeEntity.TolerancePrecision = 2
cotaCcomprimento_SF.NativeEntity.Tolerance.SetToDeviation(+0.00, -0.03 * .1)

 

heliston_guimaraes_0-1696259182076.png 

heliston_guimaraes_1-1696259202759.png

 

 

5 REPLIES 5
Message 2 of 6

You can use something like this 

Dim drwDim As Inventor.LinearGeneralDimension = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "Pick dim")

Dim txtOrigin = drwDim.Text.Origin
txtOrigin.TranslateBy(drwDim.DimensionLine.Direction.AsVector())
drwDim.Text.Origin = txtOrigin
Message 3 of 6

Thanks for the answer. It works, but it's not exactly what I need, as it will always require me to do manual editing, and if there are several quotas with the same problem, I will always need to check them one by one.
But I will save the code as it may be useful to me.
Thanks!

Message 4 of 6

If you want more complex code to fix drawing, see this post.

It solves little bit different task, but you can combine it together.

 

Message 5 of 6

Hi @heliston_guimaraes 

To start, you need to:

  1. Define the document.
  2. Find the dimension through the API and define it.
  3. Define the initial position of the dimension of interest.
  4. Define the new position of the dimension as a Point2D; in your case, you will need to add a value to the Y-coordinate.
  5. Assign the new position to the dimension.
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

Dim oTG As TransientGeometry = ThisApplication.TransientGeometry

Dim oDimensions As drawingDimensions
oDimensions = oDoc.ActiveSheet.DrawingDimensions

Dim oDimension1 As LinearGeneralDimension
oDimension1 = oDimensions.Item(19)

Dim poczatkowePolozenieWymiaru1 As Point2d	
poczatkowePolozenieWymiaru1 = oDimension1.Text.Origin

Dim nowePolozenieWymiaru1 As Point2d	
nowePolozenieWymiaru1 = oTG.CreatePoint2d(poczatkowePolozenieWymiaru1.X - 1, poczatkowePolozenieWymiaru1.Y - 0.35)

oDimension1.Text.Origin = nowePolozenieWymiaru1

This is the method I've come up with, but there may be a better and faster way to solve this problem.

Message 6 of 6

Thank you all. The comments were very useful and I was able to extract information to get the final result I wanted.
Below I leave the final code in which I obtained the result.
The last line of the schedule is what I needed.

Thanks

 

Dim cotaCcomprimento_SF = genDims_SF.AddLinear("cotaCcomprimento_SF", VIEW01_SF.SheetPoint(DistCotaComprY + .1, + DistCotaComprX), diam1_SF, profcsliso_SF, DimensionTypeEnum.kVerticalDimensionType,) 
cotaCcomprimento_SF.NativeEntity.TolerancePrecision = 2
cotaCcomprimento_SF.NativeEntity.Tolerance.SetToDeviation(+ 0.00, -0.03 * .1)
cotaCcomprimento_SF.NativeEntity.Text.Origin = ThisApplication.TransientGeometry.CreatePoint2d(cotaCcomprimento_SF.NativeEntity.Text.Origin.X, cotaCcomprimento_SF.NativeEntity.Text.Origin.Y+1)

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report