Why does an ilogic rerun it self if it start up when View is lock

Why does an ilogic rerun it self if it start up when View is lock

Darkforce_the_ilogic_guy
Advisor Advisor
332 Views
3 Replies
Message 1 of 4

Why does an ilogic rerun it self if it start up when View is lock

Darkforce_the_ilogic_guy
Advisor
Advisor

I need to find out why  my code seens to rerun or jump on ... but only it starts when it is view is lock... and it does not send any error messeng... Any idear  what cause it ?

0 Likes
333 Views
3 Replies
Replies (3)
Message 2 of 4

Sergio.D.Suárez
Mentor
Mentor

Hi, could you share the rule to be able to analyze what is happening?
regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support

@Darkforce_the_ilogic_guy,

 

Please share non confidential data to test the behavior.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 4 of 4

'This code at not all of it but it have most of the same behavier ... this one does make an error 



Sub Main() Dim NameList As New ArrayList() NameList.Add("Galv.") NameList.Add("Raw") NameList.Add("Colour 1") NameList.Add("Colour 2") NameList.Add("Hardened") NameList.Add("Do not select") Dim msg As String msg = ("Surface needed - Select Surface " & vbLf & "Part Numner: "+iProperties.Value("Project", "Part Number")& vbLf & "Description: "+iProperties.Value("Project", "Description")& vbLf & "Title: "+ iProperties.Value("Summary", "Title")& vbLf).ToString d0 = InputListBox(msg, NameList, d0, Title := "Info - Surface needed", ListName := "Surface") ' iProperties.Value("Custom", "Surface") = d0 'Tilføj farve If d0 = "Do not select" Then Else iProperties.Value("Custom", "Surface") = d0 End If 'find Document type Dim doc = ThisDoc.Document Dim sDocumentSubType As String = doc.SubType If sDocumentSubType <> "{4D29B490-49B2-11D0-93C3-7E0706000000}" And sDocumentSubType <>"{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then ' = "Part" '------------------ Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'define view rep collection Dim oViewReps As DesignViewRepresentations oViewReps = oAsmCompDef.RepresentationsManager.DesignViewRepresentations 'define view rep Dim oViewRep As DesignViewRepresentation Dim NumberOfView = oViewReps.Count ' get Manager of Representations Dim dViewRepMgr As RepresentationsManager dViewRepMgr = oAsmCompDef.RepresentationsManager 'Get active Representation View Dim dViewRep As DesignViewRepresentation dViewRep = dViewRepMgr.ActiveDesignViewRepresentation For i=1 To NumberOfView oViewReps.Item(i).Activate iLogicVb.RunExternalRule("SurfaceColour") iLogicVb.UpdateWhenDone = True Next dViewRep.Activate '--------------- 'iLogicVb.RunExternalRule("SurfaceColour") End If If sDocumentSubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or sDocumentSubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then ' = "Part" If d0 = "Colour 1" Then 'iProperties.Value("Custom", "Surface") = d0 ChangeView End If If d0 = "Colour 2" Then 'iProperties.Value("Custom", "Surface") = d0 ChangeView End If If d0 = "Galv." Then 'iProperties.Value("Custom", "Surface") = d0 ChangeView End If 'gør intet End If End Sub Sub ChangeView '''New Code Begun ''' Here Dim doc As PartDocument doc = ThisDoc.Document ' get AssemblyComponentDefinition Dim partDef As PartComponentDefinition partDef = doc.ComponentDefinition ' get Manager of Representations Dim dViewRepMgr As RepresentationsManager dViewRepMgr = partDef.RepresentationsManager Dim dViewRep As DesignViewRepresentation dViewRep = dViewRepMgr.ActiveDesignViewRepresentation Dim oName As String oName = dViewRep.Name ' get the first Representation view dViewRep = dViewRepMgr.DesignViewRepresentations.Item(oName) 'New code Ende 'set a reference to the part component definintion. Dim oPartCompDef As PartComponentDefinition oPartCompDef = ThisDoc.Document.ComponentDefinition 'define view rep collection Dim oViewReps As DesignViewRepresentations oViewReps = oPartCompDef.RepresentationsManager.DesignViewRepresentations Dim NumberOfView = oViewReps.Count For i=1 To NumberOfView oViewReps.Item(i).Activate If (iProperties.Value("Custom", "Surface")) = "Colour 1" Then Colour1 Else If (iProperties.Value("Custom", "Surface")) = "Colour 2" Then Colour2 Else If (iProperties.Value("Custom", "Surface")) = "Galv." Then Galv Else End If iLogicVb.UpdateWhenDone = True Next dViewRep.Activate End Sub Sub Colour1 Dim oPartDoc As PartDocument oPartDoc = ThisApplication.ActiveDocument 'define the appearance library Dim oLib As AssetLibrary oLib = ThisApplication.AssetLibraries("KallesoeMaterialLibrary") 'make sure colors are in assembly doc Dim libAsset As Asset libAsset = oLib.AppearanceAssets.Item("RAL 7035 Light grey") Dim localAsset As Asset Try localAsset = oPartDoc.Assets.Item("RAL 7035 Light grey") Catch localAsset = libAsset.CopyTo(oPartDoc) End Try oPartDoc.ActiveAppearance = localAsset End Sub Sub Colour2 Dim oPartDoc As PartDocument oPartDoc = ThisApplication.ActiveDocument 'define the appearance library Dim oLib As AssetLibrary oLib = ThisApplication.AssetLibraries("KallesoeMaterialLibrary") 'make sure colors are in assembly doc Dim libAsset As Asset libAsset = oLib.AppearanceAssets.Item("RAL 7037 Dusty grey") Dim localAsset As Asset Try localAsset = oPartDoc.Assets.Item("RAL 7037 Dusty grey") Catch localAsset = libAsset.CopyTo(oPartDoc) End Try oPartDoc.ActiveAppearance = localAsset End Sub Sub Galv Dim oPartDoc As PartDocument oPartDoc = ThisApplication.ActiveDocument 'define the appearance library Dim oLib As AssetLibrary oLib = ThisApplication.AssetLibraries("KallesoeMaterialLibrary") 'make sure colors are in assembly doc Dim libAsset As Asset libAsset = oLib.AppearanceAssets.Item("Galvanized (texture)") Dim localAsset As Asset Try localAsset = oPartDoc.Assets.Item("Galvanized (texture)") Catch localAsset = libAsset.CopyTo(oPartDoc) End Try oPartDoc.ActiveAppearance = localAsset End Sub

 

0 Likes