Add Mass

Batch File Open and Save (Update Properties) with Add Mass How do I add

SolidworksApi macros
Answers 11
DG
DG 2014-02-15 Best Answer

Add this line

<p>swModel.AddCustomInfo3 "", "Mass", swCustomInfoText, Chr(34) & "SW-Mass" & "@" & swModel.GetTitle & ".SLDPRT" & Chr(34)</p>

above

<p>swModel.ForceRebuild3 (False)</p>
DG
DG 2014-02-15

I don't have SolidWorks in front of me but check the attached picture to know as where you need to add the line.

SF
SF 2014-02-16

To delete the What you need to do

DG
DG 2014-02-16

To delete use the line

<p>swModel.DeleteCustomInfo "Add field name here"</p>
SF
SF 2014-07-03

Hi Deepak,

I can add custom property fields to a list of part files using SW TaskScheduler.. but as far as I can tell, this only permits/returns a "fixed" value for the property.

If I am reading this posting correctly, this is about adding "mass" (weight) field to a part files custom property in bulk...and returning the "SW-Mass@  (part file)" value

I need to do this, can you clarify/expand?

DG
DG 2014-07-03

Wrenn, adding of property is not via TS but the macro made by me which Selim is pointing to. He was trying to modify the macro to add the mass property with value as "SW-Mass@ (part file)".

In case you need to do the same then I can quickly tweak the macro for you. Do you need custom property OR configuration property??

SF
SF 2014-07-03

Just custom property..  I don't have many parts with configurations..none that are anymore than length.  for those few parts, I can do a calc on unit length at the BOM level.

DG
DG 2014-07-03

Give this one a try. Tested with Win 7x 64 SW2014 SP3.0

RS
RS 2016-02-03

Hi Deepak,

Yesterday I came across this thread and this is almost what I need. The only thing is that I prefer to have the property in the Configspecific tab.

Could you explain how to change things so this will be the output?

Regards Remy Snippe

DG
DG 2016-02-08

Does the files have one configuration OR many in the same file?

For single config, you can use AddCustomInfo3 and specify the configuration name. For others, you would need to loop thru all.