Retrieve the "Coordinate System" and "Quantity" fields from a BOM in an annotation

Hello

In the same drawing, an assembly with its associated nomenclature and the drawings of the parts of the assembly in question appears. I would like to annotate these drawings with the part coordinate system and the amount used in the assembly, but I can't find the parameters to associate.

Using the "BOM Part Number" parameter, it shows me the name of the configuration...

Attached, a screenshot of what I would like to have.

Thank you for your help.

 

 

 


capture_20171221.png

I don't think it's possible to associate the parameters for an assembly with a part view.

However, you can work around the problem (if there aren't too many parts) by creating views of the assembly in which you hide all other parts.

3 Likes

Hello

What you can try is to link the value to a cell in the nomenclature (see PC)

The link remains even if you move your part in the BOM, which can happen if you add or remove elements to your assembly. So it looks practical.

On the other hand I just discovered the option so it may have its limits

 

 

 

 

 

 


capture.png

I think there is something simpler.

After having made the MEP of the assembly with its nomenclature you create a new sheet where you insert a part of your ASS.

Then either you attach an annotation to this part by retrieving the custom property of it, then you put yourself on "Component to which the annotation is attached" and then you choose the desired property: part number, mass, material etc...

Or better, you load the properties of your part directly into the cartridge by right-clicking on the sheet and then editing the basemap. Then, in the bottom drop-down menu, you have to choose a view of this sheet. And your cartridge is filled with the properties of the part inserted into this sheet.

Here

I just tested my solution more thoroughly and it works very well:)

Here are the steps:

  • - Add annotation
  • - Insert custom text (e.g., marker:)
  • - Click on the icon in PC.
  • - Click on the box to link in the nomenclature

FYI, I moved the components in the BOM, duplicated the components in the added assembly, and removed other components to see if it ended up losing the links and it didn't.

Part quantities and coordinate systems update correctly in the annotation


capture.png
2 Likes

Thank you to all three of you for your answers.

@stefbeno:

Our assemblies can contain more than fifty parts. Your technique seems to be limited on this side.

@ludo.May:

I've already tried with this function, but I can't select the cells. It works one time out of ten...

@ronathan:

How to set this "part number" property, because it depends on the nomenclature of the drawing, not the part.

 

Eventually, I will try to automate this task with the API.

Weird that you can't select the cells. It's because you're on a separate sheet maybe.

It may work by creating the annotation on the sheet containing the bill of materials and copying and pasting it on the other sheet

I clicked on the cell, in fact you have to select its content and click next to it to validate.

So it works now?

Yes, thank you!

Now I have to get the id of my nomenclature table to be able to automate this task with VBA.

This topic might help you: https://stackoverflow.com/questions/34087325/deleting-rows-in-bill-of-materials

The full macro is used to remove a line from the nomenclature but it contains the id

 

Interesting, thank you. But it looks for the identifier of a row, not the identifier of the table.

I recorded a macro of what I wanted to achieve using the "bind value to a cell" function to know which functions to use in VBA. It looks like this:

' C:\Users\fmaisonneuve\AppData\Local\Temp\swx9184\Macro1.swb - macro recorded on 12/21/17 by FMAISONNEUVE
' ******************************************************************************
Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
boolstatus = Part.ActivateView("Vue de mise en plan8")

Dim myNote As Object
Dim myAnnotation As Object
Dim myTextFormat As Object
Set myNote = Part.InsertNote("Repère : <TABLEOBJECT ID=""1189""   RECORD ID=""8""   COLUMN ID=""2""   COMPNAME=""Chassis-6@Nomenclature2/Tole_Essai4-1@Chassis""   COLNAME=""Rep.""   WELDMENTORDNUM=""-1"">" + Chr(13) + Chr(10) + _
        "Qté : <TABLEOBJECT ID=""1189""   RECORD ID=""8""   COLUMN ID=""4""   COMPNAME=""Chassis-6@Nomenclature2/Tole_Essai4-1@Chassis""   COLNAME=""<FONT style=B>Nbre""   WELDMENTORDNUM=""-1"">" + Chr(13) + Chr(10) + _
        "Epaisseur : $PRPVIEW:""Epaisseur"" mm" + Chr(13) + Chr(10) + _
        "Matière : $PRPVIEW:""Matiere""" + Chr(13) + Chr(10) + _
        "Protection : $PRPVIEW:""Protection""")
If Not myNote Is Nothing Then
   myNote.LockPosition = False
   myNote.Angle = 0
   boolstatus = myNote.SetBalloon(0, 0)
   Set myAnnotation = myNote.GetAnnotation()
   If Not myAnnotation Is Nothing Then
      longstatus = myAnnotation.SetLeader3(swLeaderStyle_e.swNO_LEADER, 0, True, False, False, False)
      boolstatus = myAnnotation.SetPosition(0.400401767151841, 0.446719946500758, 0)
      boolstatus = myAnnotation.SetTextFormat(0, True, myTextFormat)
   End If
End If
Part.ClearSelection2 True
Part.WindowRedraw
boolstatus = Part.ActivateSheet("Feuille1")
boolstatus = Part.ActivateView("Vue de mise en plan8")
End Sub

 

To automate, I need to retrieve the value associated with "TABLEOBJECT ID" from the previously created nomenclature.

In fact in your nomenclature you can put a line designation and part number. This information should be linked to the custom properties of each coin.

Thus, by pointing an annotation on a part of your drawing, even after having made a drawing of your assembly, you will be able to retrieve the information applied before.