去评论
距米网-精简版

【使用技巧】如何在iLogic窗口控制位置表达和详细等级

JUMU
2019/11/02 23:02:47
本文会逐步介绍怎样在iLogic窗口控制装配文档的位置表达和详细等级。

第一步打开需要控制的装配文档,或者新建一个装文档,创建几个位置表达,如下图:



第二步

需要管理 → 参数,创建两个文本用户参数,命名:LODPosReps设置成多值列表,默认值可随意。





第三步

创建iLogic规则,写入以下代码:
Imports System.DiagnosticsDim oAsmDoc As AssemblyDocumentoAsmDoc = ThisApplication.ActiveDocumentDim oAsmCompDef As AssemblyComponentDefinitionoAsmCompDef = oAsmDoc.ComponentDefinition'Positional representation controlDim oPosReps As PositionalRepresentationsoPosReps = oAsmCompDef.RepresentationsManager.PositionalRepresentationsDim pv = New List(Of String)Dim oPosRep As PositionalRepresentationFor Each oPosRep In oPosRepsPV.Add (oPosRep.Name)NextMultiValue.List("PosReps") = PVoParams = oAsmDoc.ComponentDefinition.Parameters.UserParametersDim oPar As UserParameteroPar = oParams.Item("PosReps")Trace.WriteLine ("iLogic: " + oPar.Value)Dim oRef As PositionalRepresentationoRef = oAsmCompDef.RepresentationsManager.PositionalRepresentations.Item(oPar.Value)Trace.WriteLine ("iLogic: " + oRef.Name)oRef.Activate'Level Of Detail controlDim lv = New list(Of String)Dim old As LevelOfDetailRepresentationFor Each old In oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentationslv.Add (old.Name)NextMultiValue.List("LOD") = lvDim oPar1 As UserParameteroPar1 = oParams.Item("LOD")Trace.WriteLine ("iLogic: " + oPar1.Value)Dim oLOD As LevelOfDetailRepresentationoLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item(oPar1.Value)Trace.WriteLine ("iLogic: " + oLOD.Name)oLOD.ActivateoAsmDoc.Update


第四步
新建一个iLogic窗口,添加PosRepsLOD和规则,如下图:



第五步

打开iLogic窗口,此时您就可以通过iLogic窗口来控制装配文档的位置表达和详细等级了。