Operators in Custom properties

I want to include some data in my drawing template to show things like the area of the part. SW-Surface area doesn't work for me because I just need the 2D area contained on say, a 4' x 8' sheet of UHMWPE. I've realized I'll probably have to manually enter a value for this area, but I then want to take that entered value and multiply it by a certain factor like 1.25.

Ideally, the designer would enter in the area of the part and the notes on the drawing would automatically fill themselves in like so...

Area: 32 square inches Material Required: 40 square inches

Is there a way to multiply values in the value/ text expression box of custom properties?

Ben

Reply to
ben
Loading thread data ...

You might be able to do this inside of a design table. DT's are Excel sheets, so all of their functions are present.

Reply to
That70sTick

A macro could do this. I wrote a similar macro a while back that takes a pre-selected face, finds the area and writes to a custom property that is then linked to a note. If the face is changed, the macro must be rerun. The macro is handy for extrusion profiles. In your case it would need to write two custom properties. Here is a sample:

Sub main() Set swApp = Application.SldWorks Set swApp = Application.SldWorks Set Model2 = swApp.ActiveDoc If (Model2 Is Nothing) Or (Model2.GetType swDocDRAWING) Then Exit Sub End If Set DwgDoc = Model2 Set SelMgr = Model2.SelectionManager Count = SelMgr.GetSelectedObjectCount If Count 2 Then swApp.SendMsgToUser "PLEASE SELECT ONE FACE." Exit Sub End If Set selview = SelMgr.GetSelectedObject5(2)

'***get section properties*** sectprops = Model2.Extension.GetSectionProperties2(selview)

'***get area from properties convert to in from m round to 3 decimal places*** area = CStr(Round(sectprops(1) / 0.0254 / 0.0254, 3))

'***create a custom property in the Drawing*** retval = Model2.AddCustomInfo3("", "CS AREA", swCustomInfoText, area)

Model2.EditRebuild3 End Sub

Reply to
kevin.p.kenny

One way you can do it is to add a couple of extra sketches/equations to the model and then put this into the custom property of the part. This will then update should the model update. We do this for stock sizes

Reply to
j

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.