Hello Autodesk Community,
I have to create a drawing wich shows me every part of an assembly, depending on if its active or surpressed.
Ive allready tryed the View.is.active funktion and set it to an "if" to component.is.active dialog in the .idw file.
This dosnt work- error "can t use component is active in an .idw"
Tryed to add a View of the assembly in the same Drawing (may id would get any reference)-also not working
For ease: I create a .idw wich contains every part of my .iam switch the views on/off depending of their surpressing status in the .iam file.
May i can trigger it with an parameter dialog to the .idw file?..."if para=1 view is active"..im not sure
Background: For our Laser it would be usefull to get every part on a single .dxf.
After getting the parts in one single Drawing the creation of the .dxf file by ilogic would be no problem.
After among 6 month of reading the posts in this Forum (and others thx curtis) im allready at the end of the Road.
Wich means there is such an huge resource of ideas and code in here that i dont have to ask anything!..........thanks to you all!!!Great work!!!
May (sure) you can help me with my issue.
excuse my texting - its not my mothertoungue
Simon
Solved! Go to Solution.
Hi, are all the parts in one drawing view (placed as assembly)? Or each part has it's own view?
If it is the first case, then you don't even need iLogic, you can do it like this:
In open drawing double click the view you want to "link" to the assembly.
Change the "View representation" to "Default".
There's litle check box with "chain" symbol next to it, change it to be "checked".
Change the "Level of Detail" to match your assembly's one.
Now you can try to play with your assembly and the drawing will update.
Thanks for Reply,
Its the second case, every part has its own View. Quite a batch of the parts i need to cut by the laser.
Thanks for your solution but it will not work for my case.
I would need something like this:
SyntaxEditor Code Snippet
If Component.IsActive("RK_EK.iam","SL:1") = True Then
ActiveSheet.View("ANSICHT9").View.Suppressed = False
Else
ActiveSheet.View("ANSICHT9").View.Suppressed = True
End If
So i place every part of my .iam in the drawing and surrpress/unsurrpress the view, depending of the status in the .iam....
But this dosent work, i need a connection to the .iam file?......but how?
thanks for reply
See if this works:
'Define the open Document Dim openDoc As Document openDoc = ThisDoc.Document 'Look at the model file referenced in the open document Dim docFile As assemblyDocument docFile = ThisDoc.ModelDocument Dim oAsmCompDef As ComponentDefinition oAsmCompDef = docFile.ComponentDefinition If ThisDoc.ModelDocument IsNot Nothing Then Dim oCompOcc As Inventor.ComponentOccurrence For Each oCompOcc in oAsmCompDef.Occurrences On Error Resume Next 'if component is "RK_EK.iam","SL:1" check if enabled, if not suppress corresponding view'--- copy for each part in assembly '--- Copy for each part/view If oCompOcc.Name = "RK_EK.iam","SL:1" Then If oCompOcc.Enabled = True Then ActiveSheet.View("VIEW3").View.Suppressed = True Else ActiveSheet.View("*VIEW NAME*").View.Suppressed = False End If End If '--- Copy for each part/view Next End If
Subsitute the part and view names were needed.
This is mostly from memory and untested, so see how you get on and come back to me with any errors.
Thanks Neil,
this could work!
but sadly I got an error in the
If oCompOcc.Name = "RK_EK.iam","SL:1" Then
Line, but i thinks this is an copy/paste problem, or forgot an END comand?
Thanks for help
Hi,
I think the error is like you said a copy.paste issue.
the oCompOcc.Name need to reflect exactly what is in your feature tree.
so if the part in your tree says Top Plate:1 then the code needs to read :
If oCompOcc.Name = "Top PLate:1" then End if
see if that fixes it.
No...I think the Problem is by copy the code snippet.
Get an error that means i have to ad an end funktion after if.
This is a straight copy from a test assembly/drawing I made up and it worked sucessfully on:
if you've put this into a new drawing file to test it make sure and save it first.
'Define the open Document Dim openDoc As Document openDoc = ThisDoc.Document 'Look at the model file referenced in the open document Dim docFile As assemblyDocument docFile = ThisDoc.ModelDocument Dim oAsmCompDef As ComponentDefinition oAsmCompDef = docFile.ComponentDefinition If ThisDoc.ModelDocument IsNot Nothing Then Dim oCompOcc As Inventor.ComponentOccurrence For Each oCompOcc in oAsmCompDef.Occurrences On Error Resume Next 'if component is "***" check if enabled, if not suppress corresponding view'--- copy for each part in assembly '--- Copy for each part/view If oCompOcc.Name = "SCW15498-03004 Backplate:1" Then If oCompOcc.Enabled = True Then ActiveSheet.View("VIEW3").View.Suppressed = True Else ActiveSheet.View("VIEW3").View.Suppressed = False End If End If '--- Copy for each part/view Next End If
see how my component name is not the file name put the name that shows up in the assembly tree, including the :1 suffix.
EDIT:
Find attached my test assembly and drawing with internal rule .
You'll see that View3 is already suppressed as the rule says.
Can't find what you're looking for? Ask the community or share your knowledge.