Unable to create OriginIndicator on a workpoint.

Unable to create OriginIndicator on a workpoint.

Anonymous
Not applicable
580 Views
8 Replies
Message 1 of 9

Unable to create OriginIndicator on a workpoint.

Anonymous
Not applicable

Hi Experts,

 

Inventor 2017.4.5

Language: C# or VBA

 

I am attempting to create a OriginIndicator in DrawingView and would like to use a WorkPoint as reference.

This works fine in the UI and throws an exception using the API. All possible permutations and combinations has been attempted. Here is a simple sample VBA code and instructions:

1. Create a drawing document.

2. Place a base view of a part file.

3. Include any workpoint from the model.

Now run this macro:

Dim dwg As DrawingDocument
Set dwg = ThisDocument
Dim view As DrawingView
Set view = dwg.ActiveSheet.DrawingViews(1)
Dim cm As Centermark
Set cm = dwg.ActiveSheet.Centermarks(1)
Dim geomInt As GeometryIntent
Set geomInt = dwg.ActiveSheet.CreateGeometryIntent(cm)
view.CreateOriginIndicator geomInt

 

Cheers,

-Thilak Rao

0 Likes
581 Views
8 Replies
Replies (8)
Message 2 of 9

frederic.vandenplas
Collaborator
Collaborator

hi @Anonymous 

This should work (vba)

Sub CreateOrigin()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
Dim oView As DrawingView
Set oView = oSheet.DrawingViews(1)
Dim oCm As Centermark
Set oCm = oSheet.Centermarks(1)
Dim oGI As GeometryIntent
Set oGI = oCm.AttachedEntity
Call oView.CreateOriginIndicator(oGI)
End Sub
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 3 of 9

Anonymous
Not applicable

Hi Frederic,

Did you at least execute this code and see it work? Or are you assuming that it should work.

Because clearly there is a type mismatch at:

Dim oGI As GeometryIntent
Set oGI = oCm.AttachedEntity

and I do not see any line of code that does "creategeometryintent".

 

Thanks,

-Thilak Rao

0 Likes
Message 4 of 9

frederic.vandenplas
Collaborator
Collaborator

Hi @Anonymous ,

 

I've created the macro, created a baseview, placed a sketchpoint on the center of this arc, and ran the code

attachedentity is oGI is actually GeometryIntent, so i only have to refer, not create it.

Knipsel.JPG

Knipsel1.JPG

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 5 of 9

frederic.vandenplas
Collaborator
Collaborator

Correction, placed a centerpoint instead of "placed a sketchpoint"

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 6 of 9

Anonymous
Not applicable

Hi Frederic,

Appreciate your willingness to help here but I haven't resolved this yet.

1. Created a drawing view.

2. Placed a center mark.

3. Executed your macro and still got an error as attached.

BTW, I am on Inventor Release 2017.4.5

 

Thanks,

-Thilak Rao

0 Likes
Message 7 of 9

chrisdrogers
Contributor
Contributor

Did you ever find a resolution to this?  I am finding the same error when using workpoints.

0 Likes
Message 8 of 9

Anonymous
Not applicable

Yes. They fixed it in Inventor 2019.

 

Thanks,

-Thilak Rao

Message 9 of 9

chrisdrogers
Contributor
Contributor

I upgraded to Inventor 2019 and it did not work, however I discovered that the fix is in 2019.2 and greater.

0 Likes