Export the "Component Reference"

Hello everyone,

I want to retrieve the component reference to use it as a custom property during an IFC export. Is this possible?

screenshot_563

Thank you.

Hello sdevauchelle,

Here's what I just found on the web about it=>https://help.solidworks.com/2025/French/SolidWorks/sldworks/c_IFC_Files.htm
and that too =>https://www.s3dengineering.net/blog/guide-complet-pour-importer-et-exporter-des-fichiers-ifc-dans-solidworks/
Good luck.
@+.
AR.

Hello;

By Macro:

Via Nomenclature:
https://my.solidworks.com/reader/onlinehelp/2021%252Fenglish%252Fsolidworks%252Fsldworks%252Fc_component_references.htm/component-references

It is therefore reasonable to think that the property is: " Component Reference " or " ComponentReference "
(To test, this is not a property or information that we use in our BE=> No virtual components in our company...)

But technically I find it strange to use " Component References " on components with a " Part Family":
between " Designation ", the " Configuration Name" and " Description " isn't that already enough naming possibilities? (Risk of confusion?)

2 Likes

Thank you for your answers.
I will specify what I am trying to do.
I work on networks with the routing module, and I have to export them to IFC to transmit them to the BIM manager.
Here's how I do it:
1 - Saving my assembly in IFC, with export and mapping of custom properties.
2 - I open my IFC under SIMPLEBIM, in order to georeference it.
3 - under SIMPLEBIM, you are able to manually fill in new properties, or even automate this task.

The problem is that Solidworks is not able to generate different Global IDs (or GUIDs) for each element of the assembly.
We had found a solution by combining the " container name " and "name" (basically, the name of the parent assembly and that of the part) in order to create a new reference differentiating all the components and usable in BIM. But this solution is not viable because, during a new IFC export (new index), Solidworks will randomly assign the suffix differentiating the identical parts (for example two identical taps). It is therefore impossible to create a robust export.

That's why I'm looking to create a new property that can be exported to IFC, filled in once and for all at the assembly level. The " component reference" box seemed ideal to me because I could manually fill in the PID TAG of each piping element.
Unfortunately, I can't find a way to export it to an IFC.
It is possible to easily retrieve it in BOM on a drawing, which is interesting for other uses, but not for an export to BIM...

In this case, the macro with an automated concatenation seems to me the most relevant solution...
Pay attention to the " Level " of the name of the assembly to be retrieved (Head Assembly or Sub-Assembly?)

1 Like

So now, I'm dumped...
I ran the macro (by displaying the execution window), but I really don't see what it's for...

Which macro are you talking about?

If it is the "codestack.net " one , it must be modified:
" This Macro has an option to process only virtual components by setting the VIRTUAL_ONLY option to True." 
to process all the components you have to toggle the VIRTUAL_ONLY* option to False

You have to change the macro:
Currently it does the opposite of what you want to achieve:
=> It is used to copy the name of the component into the component reference.
I proposed it for example since it uses the "
ComponentReference" is therefore a " native " property in Solidworks that must be usable in your property list (I haven't found its exact title yet).

The macro below will probably be a little more telling:

1 Like

No, I'm talking about the one in your previous message:

This macro "Traverse Assembly at Component and Feature Levels Using Recursion Example (VBA)"
Is just an illustration of what is possible if you want to recover
the Name of a subassembly rather than the Name of the head assembly.
=> Relation to the requested concatenation (It all depends on your definition

1 Like

I can concatenate different properties in SIMPLEBIM, but I have to find a property that is different for two identical elements even if they are in the same assembly.
There is the name, but Solidworks randomly generates the suffix, so it's not stable.
" container name " is the name of the parent assembly in the IFC.
That's why I thought it was ideal to try to retrieve " component reference", which I can name whatever I want...
There would be " occurrence identifier" as well, but I can't change it (it's grayed out)

This parameter is not modifiable, it depends, as its name suggests, on the number of occurrences of the part deposited in the assembly (deleted or not).

2 Likes