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: 

Suppress work surfaces in components from assembly.

3 REPLIES 3
Reply
Message 1 of 4
mstumbo
236 Views, 3 Replies

Suppress work surfaces in components from assembly.

I have this code that toggles Visibility of work surfaces. I have tried to modify it so it would suppress instead, but failed.  I thought i could just swap "visibility" with "IsActive" but that did not work. Would anyone have an idea how to make this work?  Thanks.

 

 

 ORIGINAL CODE:

'Sub HideSurfacesInAsm() 'catch and skip errorsOn Error Resume Next 'define the active assemblyDim oAssyDoc As AssemblyDocument oAssyDoc = ThisApplication.ActiveDocument Dim oSurfacebody As WorkSurface Dim Vis As Boolean Dim result result = MsgBox("Make all surfaces visible?", vbYesNoCancel) Select Case result Case vbYes Vis = True Case vbNo Vis = False Case vbCancel Exit Sub End Select Dim oDoc As Inventor.Document For Each oDoc In oAssyDoc.AllReferencedDocuments For Each oSurfacebody In oDoc.ComponentDefinition.WorkSurfaces oSurfacebody.Visible = Vis Next Next ThisApplication.ActiveDocument.Update 'End Sub

MODIFIED CODE:

'
Sub HideSurfacesInAsm() 'catch and skip errorsOn Error Resume Next 'define the active assemblyDim oAssyDoc As AssemblyDocument oAssyDoc = ThisApplication.ActiveDocument Dim oSurfacebody As WorkSurface Dim SUPPR As Boolean Dim result result = MsgBox("Suppress all surface features?", vbYesNoCancel) Select Case result Case vbNo SUPPR = True Case vbYes SUPPR = False Case vbCancel Exit Sub End Select Dim oDoc As Inventor.Document For Each oDoc In oAssyDoc.AllReferencedDocuments For Each oSurfacebody In oDoc.ComponentDefinition.WorkSurfaces oSurfacebody.IsActive = SUPPR Next Next ThisApplication.ActiveDocument.Update

3 REPLIES 3
Message 2 of 4
Ktomberlin
in reply to: mstumbo

As with most things, if you can't do it using the GUI, it probably isnt available thru the API.  When you right click on a work plane, suppress isn't an option.  If you look in the programming help it also doesn't have a suppress method.  I'm wondering why you have a need to suppress vs just turning the visibility off. 

Message 3 of 4
mstumbo
in reply to: Ktomberlin

Hello Ktomberlain,

 

I have an add on that automatically creates feature cuts. For example all of my hardware in the assembly cuts its own holes. Each hole creates a surface body for itself in the part file. In order to suppress the feature holes so they do not create hidden lines on certain drawings, the surfaces created need to be suppressed. The code for Visibilties purpose is so my extents box is the correct size.  Hope that makes sense... little hard to summarize.

Message 4 of 4
Ktomberlin
in reply to: mstumbo

I've got a pretty good visual of what your need was,  Interesting add-on.  I'm wondering if you couldn't just subtract a constant value to calcualate a new extents number.  You could probably query the assembly to validate the existance of a plane on any of the faces to know whether or not you need to use the current value of extents or the modified value.  Just a thought. 

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

Post to forums  

Autodesk Design & Make Report