iLogic: DrawingView - How to get (center) mark object of included axis perpendicular to view?

iLogic: DrawingView - How to get (center) mark object of included axis perpendicular to view?

j.pavlicek
Collaborator Collaborator
1,280 Views
4 Replies
Message 1 of 5

iLogic: DrawingView - How to get (center) mark object of included axis perpendicular to view?

j.pavlicek
Collaborator
Collaborator

Hello,
how to get object which is created when perpendicular axis is included in view?
I have Axis Z included in view in plane X-Y. It creates center mark.

The mark could be created by iLogic

Dim oView As DrawingView = ...
dim oRotAx As WorkAxis = ...
oView.SetIncludeStatus(oRotAx, True)

Type of this mark is not DrawingCurve, because this code doesn't  work (throws error).

Dim oMark As Object = oView.DrawingCurves(oPatternFeature) 'This doesn't work

 Thanks for help.



Inventor 2022, Windows 10 Pro
Sorry for bad English.
0 Likes
Accepted solutions (1)
1,281 Views
4 Replies
Replies (4)
Message 2 of 5

j.pavlicek
Collaborator
Collaborator

Found something.

 

Type of the Centermark is "Centermark" (obviously). Collectoion of these objects is availible from Sheet Object. (This is why I got stuck - I was seeking in DrawingView Object).

 

So when you loop trough Centerlines collection and compare each Centermark object AttachedEntity Property with your model object (in my case WorkAxis Object), you find one or more corresponding Centermark(s) object(s).

 

But how to determine which Centermarks belongs to which DrawingView?

(Centermark.Parent Property returns a Sheet Object)



Inventor 2022, Windows 10 Pro
Sorry for bad English.
0 Likes
Message 3 of 5

JhoelForshav
Mentor
Mentor

Hi @j.pavlicek 

This will be an object of type Centermark.

You could include it and get it like this 🙂

 

Dim oSheet As Sheet = ActiveSheet.Sheet

Dim oView As DrawingView = oSheet.DrawingViews(1)
Dim oAxis As WorkAxis = oView.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition.WorkAxes("rotAxis")
oView.SetIncludeStatus(oAxis, True)

Dim oPoint As Point2d = oView.ModelToSheetSpace(oAxis.Line.RootPoint)
Dim oAxisCM As Centermark
For Each oObj As Object In oSheet.FindUsingPoint(oPoint)
	If oObj.Type = ObjectTypeEnum.kCentermarkObject
		oAxisCM = oObj
		Exit For
	End If
Next

oSheet.Parent.SelectSet.Select(oAxisCM)

 

In my example the view is of a part and the axis in the parts name is rotAxis 🙂

Message 4 of 5

JhoelForshav
Mentor
Mentor
Accepted solution

This is probably better though... Include it like this and you'll get the object 🙂

Dim oSheet As Sheet = ActiveSheet.Sheet

Dim oView As DrawingView = oSheet.DrawingViews(1)
Dim oAxis As WorkAxis = oView.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition.WorkAxes("rotAxis")
Dim oCM As Centermark = oSheet.Centermarks.AddByWorkFeature(oAxis, oView)

oSheet.Parent.SelectSet.Select(oCM)

Message 5 of 5

j.pavlicek
Collaborator
Collaborator

Many thanks for really fast help!

Centermarks.AddByWorkFeature is exactly what I looked for!



Inventor 2022, Windows 10 Pro
Sorry for bad English.