Inventor Customization

Inventor Customization

Reply
Contributor
sandhup
Posts: 27
Registered: ‎03-29-2007
Message 1 of 4 (151 Views)

visibility of workplane in assembly

151 Views, 3 Replies
11-20-2007 02:32 AM
I can as much as I try make the workplanes in sub assembly not visible through the api. These are workplanes created in as assembly that are automatically created when sketching in an assembly - I had the same problem in R11 and R2008.

This is the snippet code it, when I run through it runs but the workplanes are still visible:

Dim oPartCompDef As AssemblyComponentDefinition
Set oPartCompDef = oOccurrence.Definition

Dim n As Integer
For n = 3 To oOccurrence.Definition.WorkPlanes.count
If oPartCompDef.WorkPlanes.Item(n).Visible = True Then
Dim oWorkPlane As WorkPlane
Set oWorkPlane = oPartCompDef.WorkPlanes.Item(n)
oWorkPlane.Visible = False
End If
Next

THERE IS NO CHANGE TO WORKPLANE STATE
Contributor
sandhup
Posts: 27
Registered: ‎03-29-2007
Message 2 of 4 (151 Views)

Re: visibility of workplane in assembly

11-20-2007 02:44 AM in reply to: sandhup
It changes the visibility of the sub-assembly when its opened up. But doesnt change is visibility in the main assembly that the code needs to do. Changes in oOccurrence should persist in the main assembly, I can seem to change the workplane. Help Appreciated
*Sanjay Ramaswamy \(Autodesk\)
Message 3 of 4 (151 Views)

Re: visibility of workplane in assembly

11-20-2007 04:26 PM in reply to: sandhup
If you are familiar with the concept of proxies, you need to get the
WorkPlaneProxy object in the context of the top level assembly (active
assembly) and set the Visible property on that object. Your code jumps over
to the sub-assembly or part document and sets the visibility of the
workplane in that document.

Sanjay-

wrote in message news:5781902@discussion.autodesk.com...
It changes the visibility of the sub-assembly when its opened up. But doesnt
change is visibility in the main assembly that the code needs to do. Changes
in oOccurrence should persist in the main assembly, I can seem to change the
workplane. Help Appreciated
Distinguished Contributor
CPRob
Posts: 115
Registered: ‎11-11-2004
Message 4 of 4 (151 Views)

Re: visibility of workplane in assembly

03-06-2008 08:39 AM in reply to: sandhup
I am also trying to hide all workplanes in an assembly and am having trouble getting it to work. I have tried three methods found in various threads to no avail. They are:

1) Going directly to the occurrence in the assembly and turning the workplanes off. (assumes all parts in assembly are sub assemblies)

Dim oPlane As WorkPlane
Dim oPlanes As WorkPlanes
Dim oOccurrences As ComponentOccurrences
Dim oOccurrence As ComponentOccurrence
Dim oAssyCompDef As AssemblyComponentDefinition
Dim oSubAssyCompDef As AssemblyComponentDefinition

Set oOccurrences = oAssyCompDef.Occurrences

For Each oOccurrence In oOccurrences
Set oSubAssyCompDef = oOccurrence.Definition
Set oPlanes = oSubAssyCompDef.WorkPlanes

For Each oPlane In oPlanes
oPlane.Visible = False
Next
Next

2) Creating proxies of the workplanes with respect to the top level assembly and turning their visibility off.

Dim oPlane As WorkPlane
Dim oPlaneProxy As WorkPlaneProxy
Dim oPlanes As WorkPlanes
Dim oOccurrences As ComponentOccurrences
Dim oOccurrence As ComponentOccurrence
Dim oAssyCompDef As AssemblyComponentDefinition
Dim oSubAssyCompDef As AssemblyComponentDefinition

Set oOccurrences = oAssyCompDef.Occurrences

For Each oOccurrence In oOccurrences
Set oSubAssyCompDef = oOccurrence.Definition
Set oPlanes = oSubAssyCompDef.WorkPlanes

For Each oPlane In oPlanes
Call oOccurrence.CreateGeometryProxy(oPlane, oPlaneProxy)
oPlaneProxy.Visible = False
Next
Next

3) Using "AppAllWorkFeaturesCmd" control definition (Sanjay's code)

'Get the "Object Visibility -> All Workfeatures" command
Dim oCtrlDef As ButtonDefinition
Set oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("AppAllWorkfeaturesCmd")

'Check whether the option is checked. If it is, uncheck it.
If oCtrlDef.Pressed Then
MsgBox "Pressed"
oCtrlDef.Execute
End If

I cannot get any of these to turn off a plane in a subassembly that I don't want. The workplane is in a subassembly which is at the top level of the main assembly.

Main Assembly
-SubAssembly1
--Offending WorkPlane
-SubAssembly 2
...

What am I doing wrong here?
____________________________
Inventor Professional 2014 64 Bit
Windows 7 Professional
NVIDIA Quadro FX 4600
Dual Intel Xeon E5540 CPUs
16GB DDR3 Ram
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.