Frame Generator Grid

Frame Generator Grid

Cadkunde.nl
Collaborator Collaborator
209 Views
4 Replies
Message 1 of 5

Frame Generator Grid

Cadkunde.nl
Collaborator
Collaborator

Hello Forum,

 

I got this grid of 3d sketches created with code

Cadkundenl_0-1739546642216.png

And the idea is that you can select the lines and make a frame.

 

The engineer has to manually select all the lines, then press 'Insert Frame'

Cadkundenl_1-1739546716508.png

 

Now the Frame Generator code does not seem supported in the API.

But I can do this:

.CommandManager.ControlDefinitions.Item("AFG_CMD_InsertProfile").Execute()

- Select the lines

- 3x enter

 

 

My problem is with step 2: select the lines.

 

Because in the context of the assembly, the SketchLines3d are SketchLines3DProxy.

So how to get the SketchLines3DProxy after determining the SketchLines3d

How do i get them in a SelectSet for frame generator

 

We tried:

Occurrence.CreateGeometryProxy(line, lineproxy)

A bit like how sketch dimensions is done here:

https://adndevblog.typepad.com/manufacturing/2016/03/retrieve-sketch-dimension-of-part-document-insi...

 

But we cant seem to get it to work.

Any help is greatly appreciated!

 

 

 

 

 

0 Likes
210 Views
4 Replies
Replies (4)
Message 2 of 5

C_Haines_ENG
Collaborator
Collaborator

You're looking to get the Native Object.

 

However, I believe the objects being selected by the tool ARE project objects, so that might not be the solution you're looking for.

 

Have you considered just highlighting all the lines you want frames on?

0 Likes
Message 3 of 5

Cadkunde.nl
Collaborator
Collaborator

Hello Haines,

 

Thank you for your reply.

 

Actually we want to accomplish the opposite.

We know how to find all the sketchlines3d (native objects) in the sketch3d.

We go from assembly, to occurrence document to sketch3d and then put all the sketchlines3d in a selectset.

 

But then it gives a error, my guess because we are selecting the object not as a proxy in the assembly.

But how to do that?

 

With workpoints/planes/axes you make a proxy with transientgeometry. But we fail to do so with sketchline3d

There is a sketchline3dproxy object in the API.

We dont know how to tie these things together and make it a working selection to framegenerator.

0 Likes
Message 4 of 5

marcin_otręba
Advisor
Advisor

hi, this is blind road because it will not work, just select couple lines before clicking insert frame and you will see that it will be reseted.

Frame generator sadly is not supported by api.

You can help your designer by giving him hint that instead of clicking each line he can:

1. select all lines using mouse extend window selection

marcin_otrba_2-1740044016655.png

 

2. select sketch from treee - all lines from sketch will be selected.

marcin_otrba_0-1740043966411.png

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 5 of 5

Cadkunde.nl
Collaborator
Collaborator

Well we got something 'working'

But this whole asynch task does not feel reliable

But if we select the nodes without asynch task, it gets selected, but not added to frame generator selection.

I hope someone has a better solution

 

 

AddinGlobal.InventorApp.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute()
AddinGlobal.InventorApp.CommandManager.ControlDefinitions.Item("AFG_CMD_InsertProfile").Execute()

Task.Run(Async Function()
Await Task.Delay(100)

Try

Dim doc As AssemblyDocument
doc = AddinGlobal.InventorApp.ActiveDocument

Dim pane As BrowserPane = doc.BrowserPanes("Model")

Dim nodeDef As BrowserNodeDefinition

Dim osel As Inventor.SelectSet = doc.SelectSet
osel.Clear()

'Dit is #3D Sketch 1
For Each oNode As BrowserNode In pane.TopNode.BrowserNodes
If oNode.BrowserNodeDefinition.Label = "#Base" Then
oNode.Expanded = True
For Each subnode As BrowserNode In oNode.BrowserNodes
If subnode.BrowserNodeDefinition.Label = "#Grid" Then
subnode.Expanded = True
For Each partnode As BrowserNode In subnode.BrowserNodes
If partnode.BrowserNodeDefinition.Label.Contains("#Sketch") Then
Await Task.Delay(100)
partnode.DoSelect()
End If
'MsgBox(partnode.BrowserNodeDefinition.Label)
Next
End If
Next
End If
Next

Await Task.Delay(100)
SendKeys.SendWait("{ENTER}")

Await Task.Delay(100)
SendKeys.SendWait("{ENTER}")

Await Task.Delay(100)
SendKeys.SendWait("{ENTER}")


'Await Task.Delay(5000)
'SendKeys.SendWait("{ENTER}")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function)

0 Likes