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

Library for macros
Slasher
Posts: 43
Joined: Mon Oct 23, 2023 6:13 pm
Answers: 0
x 40
x 20

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

Unread post 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
User avatar
AlexB
Posts: 508
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 29
x 274
x 462

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

Unread post 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.
chancegarrison
Posts: 19
Joined: Wed Feb 01, 2023 5:10 pm
Answers: 0
x 1

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

Unread post by chancegarrison »

Slasher wrote: Tue Mar 05, 2024 10:39 am 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
Came to second that this would also be useful for me! Let me know if you come across something that works, please.
Post Reply