delete reference model iproperties and prompt for new entry

delete reference model iproperties and prompt for new entry

abhay.gilka
Enthusiast Enthusiast
375 Views
4 Replies
Message 1 of 5

delete reference model iproperties and prompt for new entry

abhay.gilka
Enthusiast
Enthusiast

Hi Folks,

 

I am looking for an ilogic code with prompted entry which updates both title block and also replaces the reference model's iproperties (ipt or iam) in the drawing. Appreciate any help on this.Thanks!

0 Likes
376 Views
4 Replies
Replies (4)
Message 2 of 5

william
Advocate
Advocate

Not sure if I have interpreted you question correctly, but this should help you to set the model document iProps from the idw.  You could uncomment first 2 lines to access it through the sheet views if you have a multi page drawing with different model docs. 

'doc = ActiveSheet.View("VIEW1").ModelDocument
'modelName = IO.Path.GetFileName(ActiveSheet.View("VIEW1").ModelDocument.FullFileName)

doc = ThisDrawing.ModelDocument
modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)

strStockNumber_DefaultEntry = iProperties.Value(modelName, "Project", "Stock Number")
strDescription_DefaultEntry = iProperties.Value(modelName,"Project", "Description")

strStockNumber = InputBox("Enter Stock Number", "Data Entry", strStockNumber_DefaultEntry)
strDescription = InputBox("Enter Description", "Data Entry", strDescription_DefaultEntry)

iProperties.Value(modelName, "Project", "Stock Number") = strStockNumber
iProperties.Value(modelName,"Project", "Description") = strDescription

iProperties.Value("Project", "Stock Number") = strStockNumber
iProperties.Value("Project", "Description") = strDescription
0 Likes
Message 3 of 5

WCrihfield
Mentor
Mentor

Hi @abhay.gilka.  Do you mean that you want an iLogic rule that will be ran while a drawing document is active, and you want it to dig into the TitleBlock of the active sheet and then into its TextBoxes, and find a specific one, then change which model based iProperty it is linked to?  If so, which model iProperty is it currently linked to, and which model iProperty do you want to change it to?  Doing this by code can be fairly complicated, because it includes editing the value of the TextBox.FormattedText, which usually contains XML Tags, and there is very little documentation about how those contents must be laid out in various situations.  Here is a link to the official online help page for working with FormattedText.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 5

abhay.gilka
Enthusiast
Enthusiast

The reason I am asking is because, when we copy from some of the existing designs, the model linked iproperties of the previous model still exists. I am looking for a solution to completely clear all iproperties of the model or assembly.Then start to update with the relevant iproperty value in it like "Title, Description etc. I do not want clear the custom iproperties that are linked to PDM.

0 Likes
Message 5 of 5

WCrihfield
Mentor
Mentor

Hi @abhay.gilka.  That sounds to me like you are using some type of design copy technique, but it is not doing the complete and thorough job.  It sounds like all you may need is to go through the drawing's file references and use the ReplaceReference method.  Here is a link to a contribution post I made a while back that may help with that task.  I'm guessing that once you get the file references replaced, then update the drawing document, then those iProperty links should correct themselves.

 

Because when I look at the FormattedText behind those linked iProperties within title blocks, I don't see any hard coded file paths, just whether or not they should be pointing to the 'model' or the 'drawing'.  In a DrawingDocument, the 'model' term is always referring to the first model found, within the first model view, within the whole drawing, even if there may be multiple model references.  When your drawings have multiple model references, those 'linked' iProperties within title blocks will not reflect any of them except the first one.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes