But it is not behaving the correct way. It does not always face camera. When it opens it waits for the user to click then it adds it at the origin. Help please.
I tried getting the SUComponentDefinitionEntities and filling those, then adding the componentdefinition to the model, but it says it cannot open an empty component. I really need help please. @tt_su
As I mentioned in the SO thread - that code will add the faces to the root of the model - and then create an empty definition with an instance of that definition in the model root. The definition have no use here and it will be purged by SketchUp automatically.
Not sure why you see problems when using SUComponentDefintionGetEntities - but without a complete example to plugin into the compiler and run I cannot say much. There could be details between the fragments of code you posted that cause it.
Have you looked at the examples that ship with the SDK?
(Please mark blocks of code as Preformatted Text when you post - otherwise it very hard to read the code. I edited the last post for you.)
I noticed that when I use the SUComponentDefinitionGetEntities, The component is not directly placed in the model. When I save out the model and open, it is empty. But if I open the component window, I see my component in there and have to click on it to place. Is there a way to load it automatically into the model?
I suspect that adding the definition after trying to add the instance is creating issues.
(A bit hard to say exactly without a full overview of what’s going on. That’s why I’ve been requesting a complete example.)
But try this if its not already your current structure:
Create your definition.
Add the geometry to the definition
Add the definition to the model
Add the instance to the model
Adding an instance of a definition that hasn’t been added to the model doesn’t sound like it would work. I’d be surprised if it did.
Thank you very much for your help and getting back to me quickly. I was not using my head and was using SUEntitiesAddInstance with the component entities instead of the model entities.
Again thanks for your help and getting back to me.
Oh - hm… that would lead to a recursive model. The API should not allow that. Did you get any error status returned from the functions when you tried that?