Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Underconstrained sketches

2 REPLIES 2
Reply
Message 1 of 3
Burnekl
291 Views, 2 Replies

Underconstrained sketches

Burnekl
Explorer
Explorer
Using the API I can iterate through my sketches and check each one for the fully constrained condition and issue a report with each one listed. The problem is that for a sheet metal part it is reporting unconstrained sketches for Flanges. This isn't something the drafter controls. Is there a way to have the program skip sketches associated with Flange features or other features where Inventor creates and controls the sketch?
0 Likes

Underconstrained sketches

Using the API I can iterate through my sketches and check each one for the fully constrained condition and issue a report with each one listed. The problem is that for a sheet metal part it is reporting unconstrained sketches for Flanges. This isn't something the drafter controls. Is there a way to have the program skip sketches associated with Flange features or other features where Inventor creates and controls the sketch?
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Burnekl

Anonymous
Not applicable
We probably shouldn't have exposed these sketches through the API. We're
hesitant to "fix" issues like this once it's been out for a while since
someone may have taken advantage of this for something and we would break
them to remove it.

Unfortunately there's not a simple method to determine this case either.
Since the sketch is an internal implementation of the flange, we don't
provide access to it from the feature either so you can't determine that
relationship. I did come up with one method that seems to work. This
technique checks to see if a particular sketch is shown in the browser. If
it can't, the assumption is that it's for a feature like a flange, which I
think is a valid assumption. Here's my test code.

Public Sub CheckSketch()
Dim oPart As PartDocument
Set oPart = ThisApplication.ActiveDocument

Dim oSketches As PlanarSketches
Set oSketches = oPart.ComponentDefinition.Sketches

Dim oSketch As PlanarSketch
For Each oSketch In oSketches
Dim oNativeNodeDef As NativeBrowserNodeDefinition
On Error Resume Next
Set oNativeNodeDef =
oPart.BrowserPanes.GetNativeBrowserNodeDefinition(oSketch)
If Err.Number = 0 Then
MsgBox "Good sketch: " & oSketch.Name
Else
MsgBox "Bad sketch: " & oSketch.Name
End If
On Error GoTo 0
Next
End Sub

--
Brian Ekins
Autodesk Inventor API
0 Likes

We probably shouldn't have exposed these sketches through the API. We're
hesitant to "fix" issues like this once it's been out for a while since
someone may have taken advantage of this for something and we would break
them to remove it.

Unfortunately there's not a simple method to determine this case either.
Since the sketch is an internal implementation of the flange, we don't
provide access to it from the feature either so you can't determine that
relationship. I did come up with one method that seems to work. This
technique checks to see if a particular sketch is shown in the browser. If
it can't, the assumption is that it's for a feature like a flange, which I
think is a valid assumption. Here's my test code.

Public Sub CheckSketch()
Dim oPart As PartDocument
Set oPart = ThisApplication.ActiveDocument

Dim oSketches As PlanarSketches
Set oSketches = oPart.ComponentDefinition.Sketches

Dim oSketch As PlanarSketch
For Each oSketch In oSketches
Dim oNativeNodeDef As NativeBrowserNodeDefinition
On Error Resume Next
Set oNativeNodeDef =
oPart.BrowserPanes.GetNativeBrowserNodeDefinition(oSketch)
If Err.Number = 0 Then
MsgBox "Good sketch: " & oSketch.Name
Else
MsgBox "Bad sketch: " & oSketch.Name
End If
On Error GoTo 0
Next
End Sub

--
Brian Ekins
Autodesk Inventor API
Message 3 of 3
Anonymous
in reply to: Burnekl

Anonymous
Not applicable
Thanks, that tip does seem to allow me to weed out the features I don't want to scan. I do have a follow up question though. What exactly does an "Unknown" constraint status indicate? I run my scan and many of sketches come back with an "Unknown Status". Is there some way to have the program update the sketch so that the status changes?
0 Likes

Thanks, that tip does seem to allow me to weed out the features I don't want to scan. I do have a follow up question though. What exactly does an "Unknown" constraint status indicate? I run my scan and many of sketches come back with an "Unknown Status". Is there some way to have the program update the sketch so that the status changes?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report