Adding model sketches to a drawing

Adding model sketches to a drawing

Anonymous
Not applicable
750 Views
9 Replies
Message 1 of 10

Adding model sketches to a drawing

Anonymous
Not applicable
I'm a bit confused (happens frequently). I want to add a sketch from a model into a drawing.

Basically I can to it except that the model is a sheet metal part, the drawing is of the flat pattern and the sketch I want to add is on the flat pattern. What I end up doing is adding a sketch from the folded sheet metal part.

How can I ensure that the sketch is added from the flat pattern??
0 Likes
751 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
BUMP

No comment anyone??
0 Likes
Message 3 of 10

Anonymous
Not applicable
Flat pattern sketches are not currently exposed via the API, so this won't
be possible to do currently. This is high on our priorities for a future
release.

Sanjay-
0 Likes
Message 4 of 10

Anonymous
Not applicable
Thanks for the comment Sanjay. Even if it is in the negative at least I know.
0 Likes
Message 5 of 10

Anonymous
Not applicable
There is one workaround until this is fully supported by the API. You can
use the API to select the browser node that represents the sketch and then
run the "Get Model Sketches" command. Below is one implementation that I
tested. Finding the node in the browser is the trickiest. This just looks
for the first node named "Flat Pattern".

Public Sub GetFlatSketches()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oTopNode As BrowserNode
Set oTopNode = oDoc.BrowserPanes.ActivePane.TopNode

Dim oFlatNode As BrowserNode
Set oFlatNode = FindNode(oTopNode, "Flat Pattern")
oFlatNode.EnsureVisible
oFlatNode.DoSelect

ThisApplication.CommandManager.ControlDefinitions.Item("DrawingGetModelSketchesCtxCmd").Execute
End Sub

Private Function FindNode(ParentNode As BrowserNode, Name As String) As
BrowserNode
Dim FoundNode As BrowserNode
Set FoundNode = Nothing

Dim oNode As BrowserNode
For Each oNode In ParentNode.BrowserNodes
If oNode.BrowserNodeDefinition.Label = Name Then
Set FoundNode = oNode
Exit For
Else
Set FoundNode = FindNode(oNode, Name)
End If
Next

If Not FoundNode Is Nothing Then
Set FindNode = FoundNode
Exit Function
End If
End Function

--
Brian Ekins
Autodesk Inventor API
http://modthemachine.typepad.com
0 Likes
Message 6 of 10

Anonymous
Not applicable
Brian, that's fantastic!

I'm just slowly chipping away at bits and pieces increasing the automation of repetitive tasks and here's a bit more I can add.

Dare I ask another question?

In the drawing of the flat pattern is there any way to automate adding the bend notes? Currently I've assigned the bend note to a keyboard shortcut, then having selected it I select all the drawing by hand so all the bend notes appear in one go.
0 Likes
Message 7 of 10

Anonymous
Not applicable
I don't think there's a workaround for bend notes. We got lucky with the
sketch because the "Get Model Sketches" command only needs the current
selection as input. The Bend Notes command requires you to select items
within the command. It tried pre-selecting bend lines and then running the
command but the selected bend lines are ignored.

Supporting bend notes through the API is a high priority and something we
plan to do in a future release.
--
Brian Ekins
Autodesk Inventor API
http://modthemachine.typepad.com
0 Likes
Message 8 of 10

Anonymous
Not applicable
As I'd set the keyboard Ctrl+B to select the Bend Notes function, I'd hoped to use the SendKeys command to simulate this and then select all. But it doesn't seem to like SendKeys.
0 Likes
Message 9 of 10

Anonymous
Not applicable
I don't think you can drive the selection through the keyboard, which is
what you'd be doing using SendKeys.
--
Brian Ekins
Autodesk Inventor API
http://modthemachine.typepad.com
0 Likes
Message 10 of 10

Anonymous
Not applicable
Oh well, I'm a lot further forward than when I started. One click of a button and I get the flat pattern in the my DXF drawing template complete with part number and flat pattern sketch. Ctrl+B and drag over the drawing gives me all the bend notes. Not too much of a problem as I need to reposition the part number by hand anyway.

Thanks for the input.
0 Likes