尊敬的各位用户,很抱歉通知您!
蜂特网将于2024年12月31日停止运营!

服务您是我们的荣幸

工程图的iproperty的自定义属性如何与零件的自定义属性同步?

2019-11-28

太乙

Inventor

在网站上看到用通过iLogic来解决此关联 http:www.fomt360.comshareview2449 常规、项目这些关联都蛮好,就自定义有毛病。 我在下面增加了代码 iProperties.Value("quot;Custom"quot; "quot;RBPARTNO"quot;) = iProperties.Value(modelName "quot;Custom"quot; "quot;RBPARTNO"quot;) 在零件图中也填写了对应的参数,就是没有办法关联过来, 是代码有问题吗?正确的该咋样 单次关联蛮好,就是太麻烦,我想把这个代码做到模板里面去,求大神帮忙解决下。
补充问题  2019-11-28 15:20

怎么显示有问题?

iProperties.Value("Custom", "RBPARTNO") = iProperties.Value(modelName, "Custom", "RBPARTNO")

补充问题  2019-11-30 10:15

按照这个填也不行。会提示错误。 

错误信息(在模型的自定义属性中有对应的名称)

文档 零件1 中的规则 ip 中存在错误
iProperties: 未找到名为“RBSURFACE”的特性。

详细信息

System.ArgumentException: iProperties: 未找到名为“RBSURFACE”的特性。
   在 iLogic.CadPropertiesInRule.InvPropertyInSets(PropertySets propSets, String setName, String propName, Boolean Custom)
   在 iLogic.CadPropertiesInRule.InvProperty(Document doc, String setName, String propName, Boolean Custom)
   在 iLogic.CadPropertiesInRule.get_Value(Object compoOrDocName, String setName, String propName)
   在 LmiRuleScript.Main()
   在 Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   在 iLogic.RuleEvalContainer.ExecRuleString execRule)

全部回答(1)
维
4年前 回答

给你一个参考吧


Dim oDoc As Inventor.Document

oDoc = ThisDoc.Document

If oDoc.DisplayNameOverridden() = "True" Then
oDoc.DisplayName()=""
End If' exit rule if no part or assembly is in the drawing yet

If (ThisDrawing.ModelDocument Is Nothing) Then Return

'get the filename of the doc the drawing points to

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

'read the values from the iProperties in the part/assembly file
'and apply them to the iProperties with the same name in the drawing

iProperties.Value("Summary", "Title") = iProperties.Value(modelName, "Summary", "Title")
iProperties.Value("Summary", "Subject") = iProperties.Value(modelName, "Summary", "Subject")
iProperties.Value("Summary", "Author") = iProperties.Value(modelName, "Summary", "Author")
iProperties.Value("Summary", "Company") = iProperties.Value(modelName, "Summary", "Company")

iProperties.Value("Project", "Description") = iProperties.Value(modelName, "Project", "Description")
iProperties.Value("Project", "Revision Number") = iProperties.Value(modelName, "Project", "Revision Number")
iProperties.Value("Project", "Project") = iProperties.Value(modelName, "Project", "Project")
iProperties.Value("Project", "Designer") = iProperties.Value(modelName, "Project", "Designer")
iProperties.Value("Project", "Creation Date") = iProperties.Value(modelName, "Project", "Creation Date")

iProperties.Value("Status", "Checked By") = iProperties.Value(modelName, "Status", "Checked By")
iProperties.Value("Status", "Checked Date") = iProperties.Value(modelName, "Status", "Checked Date")
iProperties.Value("Status", "Eng. Approved By") = iProperties.Value(modelName, "Status", "Eng. Approved By")
iProperties.Value("Status", "Eng. Approved Date") = iProperties.Value(modelName, "Status", "Eng. Approved Date")

'read the values from the Custom iProperties in the part/assembly file
'and apply them to the Custom iProperties with the same name in the drawing

iProperties.Value("Custom", "REMARKS") = iProperties.Value(modelName, "Custom", "REMARKS")
iProperties.Value("Custom", "BELT WIDTH") = iProperties.Value(modelName, "Custom", "BELT WIDTH")
iProperties.Value("Custom", "DETAILED") = iProperties.Value(modelName, "Custom", "DETAILED")
iProperties.Value("Custom", "DETAILED DATE") = Left(iProperties.Value(modelName, "Custom", "DETAILED DATE"),10)
iProperties.Value("Custom", "CL_APP") = iProperties.Value(modelName, "Custom", "CL_APP")
iProperties.Value("Custom", "CL_APP_DATE") = iProperties.Value(modelName, "Custom", "CL_APP_DATE")
iProperties.Value("Custom", "BASED_ON") = iProperties.Value(modelName, "Custom", "BASED_ON")
iProperties.Value("Custom", "LOCATION OF EQUIPMENT") = iProperties.Value(modelName, "Custom", "LOCATION OF EQUIPMENT")

iProperties.Value("Custom", "R0") = iProperties.Value(modelName, "Custom", "R0")
iProperties.Value("Custom", "R0 CKD") = iProperties.Value(modelName, "Custom", "R0 CKD")
iProperties.Value("Custom", "R0 DATE") = iProperties.Value(modelName, "Custom", "R0 DATE")
iProperties.Value("Custom", "R0 DESCRIPTION") = iProperties.Value(modelName, "Custom", "R0 DESCRIPTION")
iProperties.Value("Custom", "R0 DRN") = iProperties.Value(modelName, "Custom", "R0 DRN")

iProperties.Value("Custom", "R1") = iProperties.Value(modelName, "Custom", "R1")
iProperties.Value("Custom", "R1 CKD") = iProperties.Value(modelName, "Custom", "R1 CKD")
iProperties.Value("Custom", "R1 DATE") = iProperties.Value(modelName, "Custom", "R1 DATE")
iProperties.Value("Custom", "R1 DESCRIPTION") = iProperties.Value(modelName, "Custom", "R1 DESCRIPTION")
iProperties.Value("Custom", "R1 DRN") = iProperties.Value(modelName, "Custom", "R1 DRN")

iProperties.Value("Custom", "R2") = iProperties.Value(modelName, "Custom", "R2")
iProperties.Value("Custom", "R2 CKD") = iProperties.Value(modelName, "Custom", "R2 CKD")
iProperties.Value("Custom", "R2 DATE") = iProperties.Value(modelName, "Custom", "R2 DATE")
iProperties.Value("Custom", "R2 DESCRIPTION") = iProperties.Value(modelName, "Custom", "R2 DESCRIPTION")
iProperties.Value("Custom", "R2 DRN") = iProperties.Value(modelName, "Custom", "R2 DRN")

iProperties.Value("Custom", "R3") = iProperties.Value(modelName, "Custom", "R3")
iProperties.Value("Custom", "R3 CKD") = iProperties.Value(modelName, "Custom", "R3 CKD")
iProperties.Value("Custom", "R3 DATE") = iProperties.Value(modelName, "Custom", "R3 DATE")
iProperties.Value("Custom", "R3 DESCRIPTION") = iProperties.Value(modelName, "Custom", "R3 DESCRIPTION")
iProperties.Value("Custom", "R3 DRN") = iProperties.Value(modelName, "Custom", "R3 DRN")

iProperties.Value("Custom", "R4") = iProperties.Value(modelName, "Custom", "R4")
iProperties.Value("Custom", "R4 CKD") = iProperties.Value(modelName, "Custom", "R4 CKD")
iProperties.Value("Custom", "R4 DATE") = iProperties.Value(modelName, "Custom", "R4 DATE")
iProperties.Value("Custom", "R4 DESCRIPTION") = iProperties.Value(modelName, "Custom", "R4 DESCRIPTION")
iProperties.Value("Custom", "R4 DRN") = iProperties.Value(modelName, "Custom", "R4 DRN")

iProperties.Value("Custom", "YEAR_D") = Right((iProperties.Value("Custom", "DETAILED DATE")),4)


Copyright © 2019 FOMT360 沪ICP备17004251号-1    Address:厦门市湖里区日华国际大厦301J-K    phone: 0592-5590932

客服热线:0592-5590932
在线咨询