Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

place copy of mass field to file properties

Status
Not open for further replies.

alpar79

Industrial
Mar 14, 2011
14
For solidedge v.20 (for st3 is the same) how can you make a customization so that a copy of the mass field in a solidedge part file (.psm, .prt) found at inspect- physical properties – mass to be available automatically updated in file- file properties – custom in a custom field called mass?
 
Replies continue below

Recommended for you

Create the Custom Property called MASS, assign it as Text, and use the string "%{MASS}" in the Value box.

However, I am unsure of how to update it automatically, without having to update the physical properties. Also, if you use the custom property as a callout or in a title block, you will have to Update Property Text as well.
 
It won't show it in the Properties dialog. You'll have to use a callout or the like to display it.

What are you trying to do? Why not just call the actual Mass property?
 
I am implementing pdmworks enterprise pdm and i need to map mass field from solidedge to pdmworks.I can only map fields from file properties.If i can have the mass field value in the custom tab, i can transfer it automatically to pdmworks datacard... As you told me in pdmworks in mass field it appears the string "%{MASS}" as it is in file properties - custom - mass but not the value itself..
 
The easiest thing might be a VB script to extract the Physical Properties and then write it to a Custom Property. Do you have VB.Net or VB6?
 
can you do it in VB.net? i think for us it doesn't matter in what..just to be done..[bigsmile]
 
I have VB6, but not the time to do it at the moment. I can give you code to compute and retrieve the mass if you have any programming experience at all. Otherwise I'm off until next Tuesday. Attached is an .exe but it will only do one model at a time. Next week I can maybe make it cycle through all models in a directory.

Here's the code:

Public objModel As SolidEdgePart.Model
Public seApp
Dim objVariables As SolidEdgeFramework.Variables
Dim objVariable As SolidEdgeFramework.variable
Dim objVar1 As SolidEdgeFramework.variable

Public dbldensity As Double
Public dblAccuracyIn As Double
Public dblAccuracyOut As Double
Public dblVolume As Double
Public dblArea As Double
Public dblMass As Double
Public dblCofGravity() As Double
Public dblCofVolume(1 To 3) As Double
Public dblGlobalMoments(1 To 6) As Double
Public dblPrincipalMoments(1 To 3) As Double
Public dblPrincipalAxes(1 To 9) As Double
Public dblRadiiOfGyration(1 To 3) As Double
Public lngStatus As Long
Public dblStartRadiusArray() As Double
Public dblEndRadiusArray() As Double
Sub Main()
Set seApp = GetObject(, "SolidEdge.Application")
Set objModel = seApp.activedocument.Models(1)
'Get Variables Collection
Set objVariables = seApp.activedocument.Variables
'Create a variable with Add method

'Get a reference to Variable1 using Item method
Set objVar1 = objVariables.Item(1)
100
'MsgBox objVariables.Item(3).Name
dbldensity = objVariables.Item(1).Value
dblAccuracyIn = objVariables.Item(3).Value
Call GET_MASS(dbldensity)
MASS = dblMass
End Sub
Function GET_MASS(dbldensity)
' Recompute to ensure correct model info
Call objModel.ComputePhysicalProperties( _
Density:=dbldensity, Accuracy:=dblAccuracyIn, Volume:=dblVolume, _
Area:=dblArea, MASS:=dblMass, CenterOfGravity:=dblCofGravity, _
CenterOfVolume:=dblCofVolume, _
GlobalMomentsOfInteria:=dblGlobalMoments, _
PrincipalMomentsOfInteria:=dblPrincipalMoments, _
PrincipalAxes:=dblPrincipalAxes, _
RadiiOfGyration:=dblRadiiOfGyration, _
RelativeAccuracyAchieved:=dblAccuracyOut, Status:=lngStatus)
' Retrieve properties
Call objModel.GetPhysicalProperties(lngStatus, dbldensity, dblAccuracyIn, dblVolume, dblArea, dblMass, dblCofGravity, dblCofVolume, dblGlobalMoments, dblPrincipalMoments, dblPrincipalAxes, dblRadiiOfGyration, dblAccuracyOut)

Set X = seApp.activedocument.Properties.Item("Custom").Add("MASS", Round(dblMass, 3) * 2.20462262)
End Function
 
 http://files.engineering.com/getfile.aspx?folder=0720755f-8ad9-4332-95ea-0f11279cf501&file=GET_MASS.bas
I do not have programming experience, i do not know exactly what to do with this code...I will wait till next tuesday and i hope you will have time then to help me with this problem.
 
Open a part file, run the attached .exe file via

Application --> Macros --> Run Macro

And let me know if it does what you want.

Also, do you need this for Assemblies also?

what is your directory structure? Do you use Insight?
 
The attached file is a .bas extension, it must be .exe or .dll in order to run it
 
After i run the macro when i have open a .psm file, on the custom tab it appears a field called MASS of number type but with value 0.Also at inspect- physical properties - mass the value changes to 0.Before i was running this macro i checked this value here and was different from 0.
 
I have tested your macro.I have noticed the following:
- in one ocasion gave error see attachment
- in the other occasions it always shows much higher value then real for example if in physical properties i have 50.245 kg in file properties will show around 105 kg almoust double..
- whenewer i make a action to change weight (example a big hole) the value in physical properties updates when i click update or save the file, but in file properties it does not change the value until i run again the macro.If i run the weight changes but it is still around double of the normal weight.
 
 http://files.engineering.com/getfile.aspx?folder=2eb60a05-915b-4861-8c36-dbd576595de6&file=error.jpg
The way Solid Edge works, all measurements are based on a single unit. Then a corresponding value is used to display whatever the user has selected as the display units.

Thus, I programmed in to the macro a value of KG vs. LBS, which explains why you are seeing the double-ish values.

Also, as I mentioned in the beginning, there is no method I know of that will update the custom property automatically if the values of the physical properties change. I might be able to do it based on a formula using the variables table.

I'm at home and do not have access to any software so I'll look at it next week.

Are you switching to SolidWorks or just their PDM?
 
If i update the mass i need to automatically update his copy in file properties - custom.If it does not automatically and i have to run macro all time manually it is the same as i would copy from physical properties and paste it to file properties - custom...so there is no advantage, it's the same...
Even if pdmworks says his pdm is integrated to solidedge, there are several things that do not work as it should be, one example would be this thing with mass mapping.I would seriously consider changeing to solidworks the problem is migration from one to the another becouse we lose data and needs to be manually corrected..much wasted time.Eversince Siemens bought UGS, they changed licenseing methodology for pdm Teamcenter, there is no nore concurrent license now just nominal.That means that for example if you have 1 computer in factory and 100 factory workers to see with different rights different drawings (depending on their job, roles) you need to buy 100 viewer licenses of Teamcenter value more then 10000 euro.Instead in pdmworks you can buy just one concurrent license >500 euro for the same effect.
 
You could have a 'close file' macro that updated the mass and the custom property before closing the file.
Why not use pdf's of drawings, as many companies do now - the viewer is free.

bc.
2.4GHz Core2 Quad, 4GB RAM,
Quadro FX4600.

Where would we be without sat-nav?
 
I probably could use a macro, that is not a big problem, the main problem is that i need to place automatically a copy of the mass value to file properties - custom.Yes i could use pdf files of drawings and store tham into some document management program, but that is a nother separate program and i need to have all informations regarding to items in one place - pdm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor