Add ComponentOccurence / Work planes

Add ComponentOccurence / Work planes

wannensn
Enthusiast Enthusiast
627 Views
3 Replies
Message 1 of 4

Add ComponentOccurence / Work planes

wannensn
Enthusiast
Enthusiast

Hi,

when I add a new ComponentOccurence (Assembly) using

 

assDoc.ComponentDefinition.Occurrences.Add(FileName, mInventorApp.TransientGeometry.CreateMatrix)

 

all workplanes of the new component become visible.

 

How can I turn off the workplanes again.

 

Thanks,

Stephan

0 Likes
628 Views
3 Replies
Replies (3)
Message 2 of 4

philippe.leefsma
Alumni
Alumni

Hi Stephan,

 

You can try iterating through the workplanes of the ComponentOccurrence.Definition. For each workplane, create a proxy in toplevel assembly context and use WorkPlane.Visible = false.

 

If you are not familiar with assembly proxies, please refer to the API Help Overview topic "Objects in Context - Proxies".

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 4

wannensn
Enthusiast
Enthusiast

Hi Philippe,

 

thanks your solution is working the workplanes are hidden again. But what happens to workplanes which are visible in the added component? I think with your solution they will be invisible too.

 

I found out that resetting the DesignViewRepresenation manually will make them disappear. But it didn't work through the API.

 

When I add a component manually the workplanes don't become visible.

 

--Stephan

0 Likes
Message 4 of 4

philippe.leefsma
Alumni
Alumni

Hi Stephan,

 

This very much looks like an issue unfortunately, the API behavior should be consistent with the UI...

 

If you control the component insertion from your code, you may want to check which workplanes are visible and which are not before add the occurrence to the assembly, then restore the original visibility state with the workaround described previously...

 

I hope it helps,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes