- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am new to iLogic and very rusty at programming. The scenario I have been working on that i can't seem to get correct is taking the cut length of my part and multiplying it by the quantity to provide a stock total. This is all working with iProperties. I can get it to work to an extent but I need some help with some issues.
My “code” is shown below and is probably very rudimentary and incorrect.
Here are my issues:
- The iproperty "ipwModelExtents3" is created from iPropWiz 7 (from Neil Munro at www.c3mcad.com). He created some code to give me a “StockSize” based on the model extents. When you start a new part that does not have this iproperty, it faults out. I have tried to get around this, but to no avail.
- We set the “Part QTY” manually and I want to multiply the length value of the stock to provide a “totalstocklenght”.
- This works fine when using this code on existing parts, but does not work with new parts created from the default.ipt
- When the value is written to the “totalstocklength”, I would like it to show 3 place decimal. It will only do that if the number requires is (i.e. 11.237 etc.) but if it is just 11, then it only shows as 11 without the decimal.
I know these things are very simple for an experienced programmer, but that is not me
Any help or suggestions is greatly appreciated. We are in-process of simplifying our stock counting as well as automating some other processes so the sooner the better.
Thanks in advance for you help! Don't berate me too bad......LOL
Code as follows:
doc = ThisDoc.Document
'unit manager of the document
oUOM = doc.UnitsOfMeasure
If ipwModelExtents3 = Nothing Then
GoTo Skip
Else ipwModelExtents3 = "0"
End If
'get the value of each part length
partlength = iProperties.Value("Custom", "ipwModelExtents3")
iProperties.Value("custom", "partlength") = partlength
'set part quantity as quantity from ipw PART QTY
partquantity = iProperties.Value("Custom", "PART QTY")
'multiply individual lenth by quantity to get totalstocklength
totalstocklength = partlength * partquantity
iProperties.Value("Custom", "totalstocklength") = totalstocklength
totalstocklength = totalstocklength.ToString () + ""
Skip:
Solved! Go to Solution.