Page 1 of 1

Access to Component "File Properties" Through Assembly & Drawing Without Opening the Component

Posted: Tue Mar 05, 2024 10:39 am
by Slasher
Hello everyone,

Basically a macro for the subject says. I searched the forum library but could not find something similar.

I have Custom Properties setup which is great but it does not work in drawings environment o[ .
This forces me to switch back & forth a lot when I want to change properties of a component; say description, finishing note, etc.

Ideally precondition would be to pre-select an entity of the component from graphics view (for both assembly & drawings).
It'd be nice if you can select the component from BOM in drawing environment and the macro still works.

Thank you in advance!
Vahid

Re: Access to Component "File Properties" Through Assembly & Drawing Without Opening the Component

Posted: Tue Mar 05, 2024 10:59 am
by AlexB
This example shows how to get a component within the drawing view. You could also explicitly select it and use the GetSelectedObject functionality and cast the current selection as needed.

https://help.solidworks.com/2018/englis ... ple_vb.htm

From there, you can use the Component2::GetModelDoc2() function to get the pointer to that component's model. You should be able to get the custom property manager from there similar to your current macro.