Hello everybody,
I would a iLogic - to map values from the drawing in the model - code need two custom iProperties.
<PF_DRWNO> & <PF_DOC_REV>.
Does somebody has any idea?
MFG
Sascha May
Solved! Go to Solution.
Solved by Owner2229. Go to Solution.
Hi Sascha,
just let me check if I got it right.
You have two properties in the drawing. PF_DRWNO and PF_DOC_REV
Now you want to push these properties to the part file? As custom iProperties in the part file?
Hallo Dennis,
ja ich würde gerne mit einer iLogoc Regel diese zwei Werte von der Zeichnung in das Modell übertragen (PF_DRWNO and PF_DOC_REV).
Grüße
Sascha
Hello Dennis,
yes I would like to transfer these two values from the drawing in the model with an iLogic rule (PF_DRWNO and PF_DOC_REV).
greetings
Sascha
Hi, here below is the rule that should do this for you. It'll write these iProperties to the first found model document.
' Get the active document and check if it's a drawing Dim oDoc As Document = ThisApplication.ActiveDocument If Not oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub ' Get the first model document Dim oModel As Document = oDoc.ActiveSheet.DrawingViews.Item(1).ReferencedFile Dim oPropsets As PropertySets = oModel.PropertySets Dim oPropSet As PropertySet = oPropsets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}") ' Pass the iProperties Dim iProOne As String = "PF_DRWNO"
Dim iProTwo As String = "PF_DOC_REV"
Try oPropSet.Item(iProOne).Expression = iProperties.Value("Custom", iProOne) Catch oPropSet.Add("", iProOne) oPropSet.Item(iProOne).Expression = iProperties.Value("Custom", iProOne) End Try Try oPropSet.Item(iProTwo).Expression = iProperties.Value("Custom", iProTwo) Catch oPropSet.Add("", iProTwo) oPropSet.Item(iProTwo).Expression = iProperties.Value("Custom", iProTwo) End Try
Sorry, ich habe diese Fehlermeldung, wenn die Regel in der Zeichnung gestartet wird:
Regelkompilierungsfehler in DocId Zeichnung nach Modell, in 325139_Türblech_513254.idw
Fehler in Zeile 6 : "end of"-Anweisung erwartet.
Fehler in Zeile 7 : "oModel" ist nicht deklariert. Auf das Objekt kann aufgrund der Schutzstufe möglicherweise nicht zugegriffen werden.
Try it now:
' Get the active document and check if it's a drawing Dim oDoc As Document = ThisApplication.ActiveDocument If Not oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub ' Get the first model document Dim oModel As Document = oDoc.ReferencedDocuments.Item(1) Dim oPropsets As PropertySets = oModel.PropertySets Dim oPropSet As PropertySet = oPropsets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}") ' Pass the iProperties Dim iProOne As String = "PF_DRWNO"
Dim iProTwo As String = "PF_DOC_REV"
Try oPropSet.Item(iProOne).Expression = iProperties.Value("Custom", iProOne) Catch oPropSet.Add("", iProOne) oPropSet.Item(iProOne).Expression = iProperties.Value("Custom", iProOne) End Try Try oPropSet.Item(iProTwo).Expression = iProperties.Value("Custom", iProTwo) Catch oPropSet.Add("", iProTwo) oPropSet.Item(iProTwo).Expression = iProperties.Value("Custom", iProTwo) End Try
Hallo,
die iProperties werden jetzt geschrieben, bleibven aber nicht im Modell (sie löschen sich wieder, wenn die Zeichnung geschlossen wird) 😞
Grüße Sascha
Hallo,
das ist, weil Sie das Modell Dokument zu speichern müssen.
Ich würde nicht empfehlen, so durch das Programm zu tun, da es einige Probleme verursachen können (vor allem, wenn Sie die Änderung auf das Modell nicht speichern wollen).
Wie auch immer, fügen Sie diese Zeile am Ende des Codes und es wird die das Modell Dokument speichern:
oModel.Save()
Übersetzt von Google Translator, tut mir so leid für alle möglichen Fehler.
Can't find what you're looking for? Ask the community or share your knowledge.