Generating execute preview with "ghost" components

Generating execute preview with "ghost" components

arbezuber
Participant Participant
700 Views
3 Replies
Message 1 of 4

Generating execute preview with "ghost" components

arbezuber
Participant
Participant

Hello, I have an add-in where I create components based on a few inputs and I create preview using execute preview event. One of the inputs is a selection input with selection filter for e.g., faces. The problem is that whenever the add-in creates the preview I can still select some faces of the components created in the preview. Effect is that it causes disappearing of the preview components like the preview was never executed. Also sometimes selection input accepts components from the browser regardless of selection filters. If it happens, add-in crashes.

 

Solution to those problems would be generating something like a "ghost" components during preview - they wouldn't be selectable and wouldn't appear in browser. Only after clicking "OK" button they would be generated and appeared in the browser. That's the way it is done e.g., in the "Extrude" command when the "new body" or "new component" option is chosen, but I have absolutely no idea how to achieve it.

 

Maybe you can suggest other solution/going another way?

 

 

0 Likes
Accepted solutions (1)
701 Views
3 Replies
Replies (3)
Message 2 of 4

rolandas_vegis
Advocate
Advocate
Accepted solution

Hello, if you want similar functionality to Extrude command, you can achieve it by using custom graphics. You can draw custom graphics body/face or whatever else you need in the execute preview event. After clicking Ok you then create real components.

Message 3 of 4

arbezuber
Participant
Participant

Custom graphics is definitely what I'm looking for. Thank you @rolandas_vegis

Here is the API sample for that if somebody is looking for more information.

0 Likes
Message 4 of 4

arbezuber
Participant
Participant

I have quite complicated bodies to show in execute preview so I thought I could use a addBRepBody method which basically clones any BRep body to the form of custom graphics. It works fine except performance loss (FPS drop) is significant when I clone a few custom graphics from quite complicated body (like torus or combinations of simple shapes). However copying the same BRep body from which the custom graphics was created, even 100 times, doesn't affect the performance visibly.

 

This manual says that:


Most of the graphics you typically see when looking at a Fusion 360 design are made up of triangles. Internally, when doing solid, surface, and T-Spline modeling, the model is mathematically exactly represented using smooth surfaces. For example, a solid cylinder is defined using a cylinder and two planes but this can’t directly be displayed by the graphics card so Fusion 360 automatically calculates a triangle mesh representation of the model and uses that for the display. The underlying mathematically exact model is unchanged and that’s what you continue to use for modeling but you’re looking at the triangle mesh version of the model. It doesn’t look like a triangle mesh because there are enough triangles that it looks smooth and the graphics system applies lighting in a way so you don’t see flat triangles but instead it appears smooth.

So the cloned custom graphics shouldn't really differ from its original BRep body in terms of performance, but it does. Is there a workaround or some other "trick" I don't know about?

 

You can test this using the "Custom Graphics API Sample" I linked in my previous post, selecting the BRep Custom Graphics Object in the menu and selecting a body you want to clone.

0 Likes