Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

BOM

Status
Not open for further replies.

Santa123

Mechanical
Oct 2, 2006
80
PL
Hello,

I red some arts about BOM, but I can't still figure out, why I do not have mass position in "Define formats".

Best Regards
Santa123
 
Replies continue below

Recommended for you

Thanks ferdo

I have Catia R21 and when I right click on the value field of the new property I have options:
- Add Multiple Values
- Add Range
- Edict Comment
- Lock

I do not have formula option, but I can add formula by means of formula button from Knowledge Tool bar.
Is it possible to add parameters to Product Added field by macro?

Respect
Santa123
 
Hi,

But I ned to add mass and material to 50 existing Parts, so I think the best way to do this is by means of macro.

Respect
Santa123
 
I wrote a small code for You:

Code:
Language="VBSCRIPT"

Sub CATMain()

Set documents1 = CATIA.Documents


for i=1 to CATIA.Documents.count

Set partDocument1 = documents1.item(i)

if typename(partDocument1)="PartDocument" then

Set product1 = partDocument1.Product

Set parameters1 = product1.UserRefProperties

Set part1 = partDocument1.Part

Set parameters2 = part1.Parameters

Set strParam2 = parameters2.Item("Material")

 Err.Clear
  On Error Resume Next
    Set strParam1=parameters1.Item("Material")
    errNumber = CLng(Err.Number)

if errNumber <> 0 then
Set strParam1 = parameters1.CreateString("Material", strParam2.Value)
else
strParam1.valuatefromstring(strParam2.Value)
end if

Err.Clear
  On Error Resume Next
    Set dimension1 = parameters1.Item("Mass")
    errNumber = CLng(Err.Number)
if errNumber <> 0 then
Set dimension1 = parameters1.CreateDimension("Mass", "MASS", 0.000000)
dimension1.ValuateFromString Cstr(1000000*product1.analyze.mass)&"mg"
else
dimension1.ValuateFromString Cstr(1000000*product1.analyze.mass)&"mg"
end if

end if
next

End Sub

Let me know if it works

LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
 
Wooooow, This is what I was looking for. Works great, Thanks a lot. This code will save me a lot of time. Tell me one more think, where is a place in the code, where You receive mass.

Respect
Santa123
 
Code:
product1.analyze.mass
(as integer)

Anyway, You can use this code to set and update those parameters.

To change parameter name change "Mass" in line above

Mass is calculated automatically for each part in properties->mass depending on volume and density, You need to define material properties (density) to get proper value

LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
 
Hi,
lukaszsz / fernando

I wonder is there any way to link this mass to the drawing document parameter named "weight" which in-turn will link back to a text in background as an attribute link.
i.e
Mass -----------------------> Weight --------------------------> Text
(Part Parameter) or (Drawing Parameter) (Drawing Text)
(Product Parameter)

establishing an external link while doing the above said parameter mapping will make the job a lot easier.

Also,
How to create external properties using macro and add a relation between them, I mean two different documents.(could u make an example and show for better clarity.)
Automation Documentation doesn't really provide any information on this. Do we have to this external linking manually or what?
could you guys help me on the same.

Regards.
Maddy
 
I wonder is there any way to link this mass to the drawing document parameter named "weight" which in-turn will link back to a text in background as an attribute link.

It could be very interesting, as I found, there is no possibility to create external parameter through CATIA (as end-user), maybe automation will helps. There is no other option than try do it yourself :)


Also,
How to create external properties using macro and add a relation between them, I mean two different documents.(could u make an example and show for better clarity.)

External parameters via VBA:
How to define UserDefinedProperties as relation with existing parameter
(12th reply)



LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
 
Hi,

Sorry if i'm wrong, this is in regard with automation only.

I want to simulate end user activity in linking parameter of one document with the parameter of other document.
take Mass as said above.
End user activity
1. User will measure the inertia which creates "Mass" in part document.
2. User will create a parameter in drawing called "Weight"
3. User will link this drawing parameter "Weight" with the "Mass" of part parameter through f(x) dialog box.
- Doing so will result in creation of external parameter automatically in drawing along with relation (i.e similar to formula creation).
If user changes the part then mass will get changed.
To get the updated "Mass" value displayed in "Weight"'s property, user needs to sync the external parameter in drawing.

My requirement is to simulate the same through automation.

If not clear will upload a video for reference.

Regards,
Maddy


 
oops,sorry forgot to mention

Thanks for time though and will go through v5vb


Regards,
Maddy
 
3. User will link this drawing parameter "Weight" with the "Mass" of part parameter through f(x) dialog box.

How does formula look like? I'm wondering, because I've never linked external parameters through f(x) without copy-paste special elements.

Of course, If You know how to perform those steps as end-user, it also can be done automatically, through VBA/VBScript.

At this moment the only solution I know is to update Weight parameter through catvba, with no links to referenced CatPart or its parameters, so please, post Yours formula.

Lukasz

LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top