Create a custom property that refers to the layout of a room

Hello

 

Here's my problem. I want to rename the tabs in my plan to my part number (stored in the NUMERO_DESSIN custom property).

 

So I'm using the 

Nom_Onglet = SWmoddoc.GetCustomInfoValue("", "NUEMRO_DESSIN")

 

However, the NUMERO_DESSIN property is a property of the room and not of the plane. However, this function apparently only works with the properties of the plane.

 

For example, I would like to create a property of the plan that takes the property of the NUMERO_DESSIN room as a value.

 

I tried to create a plane property with the value $PRPSHEET:"NUMERO_DESSIN" like in the title block, to refer to the part property, but it doesn't work...

 

 

Any idea?

 

Or if you know of a command identical to SWmoddoc.GetCustomInfoValue but which ^would allow you to retrieve the properties of the open part in the plan.

 

Thank you in advance!

Here's the solution:

You have to activate the first view of the drawing to retrieve the name of the part, only then can you retrieve the custom properties.

Here is the procedure I use to retrieve the custom property " code " from a drawing :

 

' #####################################################################

'part for retrieving personal properties'

We activate the 3D for the retrieval of the information

' ##########################################

Set swApp = Application.SldWorks

Set CurrentDOC = swApp.ActiveDoc' retrieves the current document

Set swModel = swApp.ActiveDoc

Set swConfigMgr = swModel.ConfigurationManager

Set swDraw = swModel

Set swView = swDraw.GetFirstView

Set swView = swView.GetNextView 'enables/retrieves the first view for custom properties

Set swRefDoc = swView.ReferencedDocument  ' We now have swRefDoc the 3D of the drawing

CODE = swRefDoc.GetCustomInfoValue("", "code")

 

See also:

http://www.lynkoa.com/sites/default/files/questions/answer/30/10/2015/macro_pdf_reference.txt

 

1 Like

Thank you .PL! On the other hand I have a problem because it tells me that the variables are not defined and I don't really know what type they correspond to in all these cases.

For your case, you just have to replace:

CODE by NUMERO_DESSIN:

NUMERO_DESSIN= swRefDoc.GetCustomInfoValue("", "NUMERO_DESSIN") 'we get the property NUMERO_DESSIN

Then, you have to use this varialbe NUMERO_DESSIN in the other macro to rename your sheet (to the "plan" palce)