- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I'm looking for the iLogic code to read which view rep is currently active in a part file so that I can then perform a few mods to the part via IF statements. I can't however find a way to read the active view representation from existing snippets or forum posts.
Example....
Dim oViewRep as ??????????????????????
If oViewRep = "View1" Then Mods to part... Else Other mods to part.... End If
Any help on reading the existing view rep would be appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, With this code you can read what is the view of active representation in your part or assembly.
Dim oDoc As Document = ThisDoc.Document Dim oDef As ComponentDefinition = oDoc.ComponentDefinition Dim ActViewRep As String = oDef.RepresentationsManager.ActiveDesignViewRepresentation.name Dim ActPosRep As String = oDef.RepresentationsManager.ActivePositionalRepresentation.name Dim ActLOD As String = oDef.RepresentationsManager.ActiveLevelOfDetailRepresentation.name MessageBox.Show(ActViewRep)
I hope it will be useful to develop what you need. 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thank you for the code! This seems to work for an assembly but not for a part.
I get the following error:
Object variable or With block variable not set.
System.NullReferenceException: Object variable or With block variable not set. at Microsoft.VisualBasic.CompilerServices.Symbols.Container..ctor(Object Instance) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) at LmiRuleScript.Main() at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem) at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Ignore that!
Works for parts if I remove the positional and LOD lines since they are not available in an ipt.
Thank you for the help ![]()