iLogic changes UOM shown on drawings
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I just started using iLogic and am looking for some verification that I'm doing things correctly. We mainly use lbmass on our drawings for the UOM we enter into our ERP system, but some parts use length (usually in ft). I've updated our drawing template to look for a parameter from the model (named Length). If Length exists, it uses that to insert into the UOM field on our drawings. If it's not there, then it pulls in the mass from the model. It looks like it works, but I'm a little hesitant to publish these templates since I'm so new to iLogic. Does my code look correct? Am I missing something that could cause issues?
I'm curious if there is a better way to deal with the mass property. Before this code I had the mass from the model automatically fill in the value on our title block and it always pulled in lbmass. With this code, it changed the units to kg and I had to convert it. Is there a way to fill in this value without having to convert?
Is there a way to detect the units tied to the parameters (length)? We usually draw things in inches, but we do have some parts that are in mm. I'd like to add something to the code to know what do do when parts are in mm instead of inches.
Here's my code:
'get the model the drawing is referencing (1st view) modelname = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName) Parameter.Quiet = True If Parameter(modelname, "Length") Then UOM = Parameter(modelname, "Length") iProperties.Value("Custom", "UOM") = UOM / 12 iProperties.Value("Custom", "Units") = "ft" Else UOM = iProperties.Mass(modelname) iProperties.Value("Custom", "UOM") = UOM * 2.20462 iProperties.Value("Custom", "Units") = "lbmass" End If 'update drawing iLogicVb.UpdateWhenDone = True