How to change the Origin Indicator position

How to change the Origin Indicator position

Crstiano
Collaborator Collaborator
1,730 Views
4 Replies
Message 1 of 5

How to change the Origin Indicator position

Crstiano
Collaborator
Collaborator

Hi guys,

 

How to change the Origin Indicator position on drawing view?

how do I attach a new Intent ?

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


Cristiano Oliveira
EESignature
ConsultCAD.com

0 Likes
Accepted solutions (1)
1,731 Views
4 Replies
Replies (4)
Message 2 of 5

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @Crstiano 

 

I wrote this example ilogic code for you.

I made a simple part with a workpoint in it named "TestPoint". Then i created a drawingview from this part.

the code includes the workpoint, finds it centermark in the view and creates geometryintent from it.

Then if there already is an origin indicator it moves it to the point, else it creates it on the point.

 

Hope it helps 🙂

 

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)
Dim oPartDoc As PartDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oWP As WorkPoint = oPartDoc.ComponentDefinition.WorkPoints.Item("TestPoint")

oView.SetIncludeStatus(oWP, True)

Dim oWPCenterMark As Centermark
Dim oCenterMark As Centermark
For Each oCenterMark In oSheet.Centermarks
	If oCenterMark.AttachedEntity Is oWP Then
		oWPCenterMark = oCenterMark
		oWPCenterMark.Visible = True
	End If
Next

Dim oGeometryIntent As Inventor.GeometryIntent
oGeometryIntent = oSheet.CreateGeometryIntent(oWPCenterMark, kPoint2dIntent)

If oView.HasOriginIndicator
oView.OriginIndicator.Intent = oGeometryIntent
Else
oView.CreateOriginIndicator(oGeometryIntent)
End If

oCenterMark.Visible = False
0 Likes
Message 3 of 5

JhoelForshav
Mentor
Mentor

I edited the code so it doesnt include a point over and over again if you use it to toggle the origin indicator back and forth between two points:

 

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)
Dim oPartDoc As PartDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oWP As WorkPoint = oPartDoc.ComponentDefinition.WorkPoints.Item("Center Point")
If oView.GetIncludeStatus(oWP) = False Then oView.SetIncludeStatus(oWP, True)
Dim oWPCenterMark As Centermark
Dim oCenterMark As Centermark
For Each oCenterMark In oSheet.Centermarks
	If oCenterMark.AttachedEntity Is oWP Then
		oWPCenterMark = oCenterMark
	End If
Next
Dim oGeometryIntent As Inventor.GeometryIntent
oGeometryIntent = oSheet.CreateGeometryIntent(oWPCenterMark, kPoint2dIntent)

If oView.HasOriginIndicator
	oView.OriginIndicator.Intent = oGeometryIntent
Else
	oView.CreateOriginIndicator(oGeometryIntent)
End If

oCenterMark.Visible = False
0 Likes
Message 4 of 5

Crstiano
Collaborator
Collaborator

It so simple... and I tried many another ways 🙂

oView.OriginIndicator.Intent = NewIntent

 

Thanks @JhoelForshav 

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


Cristiano Oliveira
EESignature
ConsultCAD.com

Message 5 of 5

tecnico
Contributor
Contributor

Unfortunately the rule gives errors, I would need to create a point in the center of my part. and make it invisible in 3D but include it inside my 2D table, I can't find the rule to create a point nor the way to position it in the center, it is clear not at the center of gravity, but at the center of the maximums of the figure.

0 Likes