Message 1 of 2
Making Solid Body Translucent - iLogic Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I would like to describ my problem for a quick.
I have multi body part with specific solid body names. The solid bodies represent parts in machine. Entire file as a one multi body part should be used as 3D block for presentations. One solid body and its transparency should be able to be switched between Yes and No by Boolean variable - double mode transparency On and Off. I tried to write a code which could fullfill that task, but I'm still struggling.
Take a look please:
Sub Main()
If ABDECKUNG = True Then Call VollBodyTrans("Abdeckung_W_K_01", 1) Call VollBodyTrans("Abdeckung_W_K_02", 1) Call VollBodyTrans("Abdeckung_M_K_01", 1) Call VollBodyTrans("Abdeckung_M_K_02", 1) Call AbdeckungTrans("Polycarbonat - Rauch") Else If ABDECKUNG = False Then Call VollBodyTrans("Abdeckung_W_K_01", 0) Call VollBodyTrans("Abdeckung_W_K_02", 0) Call VollBodyTrans("Abdeckung_M_K_01", 0) Call VollBodyTrans("Abdeckung_M_K_02", 0) Call AbdeckungTrans("Galvanisiert") End If End Sub Sub AbdeckungTrans (AbdTrans As String) Feature.Color("Abdeckung_M_01") = AbdTrans Feature.Color("Abdeckung_M_02") = AbdTrans Feature.Color("Abdeckung_W_01") = AbdTrans Feature.Color("Abdeckung_W_02") = AbdTrans End Sub Sub VollBodyTrans (oBodyName As String, oBodyTransParam As Boolean) Dim oDoc As PartDocument oDoc = ThisApplication.ActiveDocument Dim oCompDef As ComponentDefinition oCompDef = ThisDoc.Document.ComponentDefinition Dim oSurface As WorkSurface Dim oBody As SurfaceBody Dim MyArrayList As New ArrayList i = 1 For Each SurfaceBody In oCompDef.SurfaceBodies oBody = oCompDef.SurfaceBodies.Item(i) MyArrayList.Add(oBody.Name) i = i + 1 Next j = 1 For Each SurfaceBody In oCompDef.SurfaceBodies oBody = oCompDef.SurfaceBodies.Item(j) For Each oSurface In oDoc.ComponentDefinition.WorkSurfaces If oBody.Name = oBodyName Then oSurface.Translucent = oBodyTransParam End If Next MyArrayList.Add(oBody.Name) j = j + 1 Next End Sub
The name "Abdeckung_W_K_01" for instance is the name of particular solid body.
Could anyone help me out with that issue.
At the moment, the solid body changes its color but not transparency. Beside this there is no error message what so ever.
Take care,
Thomas