iLogic Automated Dimension Jumping Around

iLogic Automated Dimension Jumping Around

richard.joseph.pollak
Advocate Advocate
727 Views
2 Replies
Message 1 of 3

iLogic Automated Dimension Jumping Around

richard.joseph.pollak
Advocate
Advocate

I created an iRule that generates a centered-pattern center-line and then dimensions its diameter.

Unfortunately, once the dimension has been generated, if the view is moved, the dimension's position relative to the view jumps around.

 

Does anybody know of a way to get this dimension to behave more like a manually placed dimension would? (Staying in place relative to the view when the view is moved)

 

Here is an excerpt from the iRule that generates the dimension:

 

oCL = oCenterlines.AddCenteredPattern(oSheet.CreateGeometryIntent(oEdgeCurve),oMarks1,,,True)
oPt = oCL.StartPoint
oGeometryIntent = oSheet.CreateGeometryIntent(oCL, oPt)
oPt = oTG.CreatePoint2d(oView.Left + 6.6, oView.Top - 4.4)
oDim = oGeneralDims.AddDiameter(oPt, oGeometryIntent)

Here are pictures of the dimension after creation followed by after moving the view:


After CreationAfter CreationAfter Moving ViewAfter Moving View

 

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

bradeneuropeArthur
Mentor
Mentor

What version of inventor are you using?

 

Please share the complete coding you are using.

 

Then we can take a look if something is wrong regarding the dimensions settings!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 3

richard.joseph.pollak
Advocate
Advocate

I apologize for the slow reply. This code generates a large number of dimensions, so I took out the irrelevant parts and tested to make sure that I included all the relevant code.

 

I am using Autodesk Inventor Professional 2015.

The SlotCenter Attributes are workpoints at the centers of slots arranged in a circular patter. This code creates a circular centerline through those workpoints and dimensions its diameter. I used the Attribute Helper plugin to create the workpoint attributes in the model.

 

This code creates the dimension without any problems. But for some reason, the location of the dimension text jumps around. This typically only happens when the view is moved, but sometimes it jumps when the file is opened again after saving. It seems to jump to the horizontal origin of the diameter dimension.

 

Thank you for taking the time to reply to my post.

 

Dim oDoc As DrawingDocument
Dim oSheet As Sheet
Dim oView As DrawingView
Dim oAssyDoc As AssemblyDocument
Dim oComp As Inventor.ComponentOccurrence
Dim oTG As TransientGeometry
Dim oGeneralDims As GeneralDimensions
Dim oIDEdge As Edge
Dim oIDEdgeProx As Inventor.EdgeProxy = Nothing
Dim oEdgeCurve As DrawingCurve
Dim oObjs As ObjectCollection
Dim oPt As Point2d
Dim oDim As GeneralDimension
Dim oCenterlines As Centerlines

oDoc = ThisDoc.Document
oSheet = oDoc.ActiveSheet
oAssyDoc = ThisDrawing.ModelDocument
oTG = ThisApplication.TransientGeometry
oGeneralDims = oSheet.DrawingDimensions.GeneralDimensions

i = 1
rda = ""
Do Until rda = "name of stabilized subassembly"
	oComp = oAssyDoc.ComponentDefinition.Occurrences.Item(i)
	rda = oComp.Name
	i = i + 1
Loop

oView = ActiveSheet.View("View1").View

oObjs = oAssyDoc.AttributeManager.FindObjects("DIM", "AssemblyID", "1")
oIDEdge = oObjs.Item(1)
oComp.CreateGeometryProxy(oIDEdge, oIDEdgeProx)
oViewCurves = oView.DrawingCurves(oIDEdgeProx)
oEdgeCurve = oViewCurves.Item(1)

Dim oBCPoint1 As WorkPoint
Dim oBCPoint2 As WorkPoint
Dim oBCPoint3 As WorkPoint
Dim oBCPoint4 As WorkPoint
Dim oBCPoint5 As WorkPoint
Dim oBCPoint6 As WorkPoint
Dim oBCPoint7 As WorkPoint
Dim oBCPoint8 As WorkPoint
Dim oODPoint As WorkPoint
oObjs = oAssyDoc.AttributeManager.FindObjects("DIM", "SlotCenter1", "1")
oBCPoint1 = oObjs.Item(1)
oObjs = oAssyDoc.AttributeManager.FindObjects("DIM", "SlotCenter2", "1")
oBCPoint2 = oObjs.Item(1)
oObjs = oAssyDoc.AttributeManager.FindObjects("DIM", "SlotCenter3", "1")
oBCPoint3 = oObjs.Item(1)
oObjs = oAssyDoc.AttributeManager.FindObjects("DIM", "SlotCenter4", "1")
oBCPoint4 = oObjs.Item(1)
oObjs = oAssyDoc.AttributeManager.FindObjects("DIM", "SlotCenter5", "1")
oBCPoint5 = oObjs.Item(1)
oObjs = oAssyDoc.AttributeManager.FindObjects("DIM", "SlotCenter6", "1")
oBCPoint6 = oObjs.Item(1)
oObjs = oAssyDoc.AttributeManager.FindObjects("DIM", "SlotCenter7", "1")
oBCPoint7 = oObjs.Item(1)
oObjs = oAssyDoc.AttributeManager.FindObjects("DIM", "SlotCenter8", "1")
oBCPoint8 = oObjs.Item(1)
oObjs = oAssyDoc.AttributeManager.FindObjects("DIM", "pointOD", "1")
oODPoint = oObjs.Item(1)

oBCCM1 = oSheet.Centermarks.AddByWorkFeature(oBCPoint1, oView)
oBCCM2 = oSheet.Centermarks.AddByWorkFeature(oBCPoint2, oView)
oBCCM3 = oSheet.Centermarks.AddByWorkFeature(oBCPoint3, oView)
oBCCM4 = oSheet.Centermarks.AddByWorkFeature(oBCPoint4, oView)
oBCCM5 = oSheet.Centermarks.AddByWorkFeature(oBCPoint5, oView)
oBCCM6 = oSheet.Centermarks.AddByWorkFeature(oBCPoint6, oView)
oBCCM7 = oSheet.Centermarks.AddByWorkFeature(oBCPoint7, oView)
oBCCM8 = oSheet.Centermarks.AddByWorkFeature(oBCPoint8, oView)
oODCM = oSheet.Centermarks.AddByWorkFeature(oODPoint, oView)
oODCM.Visible = False

oCenterlines = oSheet.Centerlines
Dim oMarks1 As ObjectCollection
oMarks1 = ThisApplication.TransientObjects.CreateObjectCollection
oMarks1.Add(oBCCM1)
oMarks1.Add(oBCCM5)
Dim oGeometryIntent As GeometryIntent
oCL = oCenterlines.AddCenteredPattern(oSheet.CreateGeometryIntent(oEdgeCurve),oMarks1,,,True)
oPt = oCL.StartPoint
oGeometryIntent = oSheet.CreateGeometryIntent(oCL, oPt)
oPt = oTG.CreatePoint2d(oView.Left + 6.6, oView.Top - 4.4)
oDim = oGeneralDims.AddDiameter(oPt, oGeometryIntent)
oPt = oDim.Text.Origin
oPt.X = oPt.X - 1
oDim.Text.Origin = oPt
oDimAtt = oDim.AttributeSets.Add("iLogic_Created")
0 Likes