Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatically turning off Workfeatures.

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
Anonymous
1635 Views, 12 Replies

Automatically turning off Workfeatures.

Is there a way to automate the process of turning off the Workfeatures in a .iam and STILL be able to add new Workfeatures.  View>Object Visibility is not the answer because you are unable to construct NEW Workfeatures.  If there isn’t a menu selection, can a “batch file” be developed to search the Browser and turn off all Workfeatures currently listed in the tree? 

 

 

12 REPLIES 12
Message 2 of 13
coreyparks
in reply to: Anonymous

The following VB code will turn off all work planes, axis and points currently visible in the drawing whether they are user created or the default origin planes.  Place this code inside a module of a VB project and run it from there.  I use this all the time and it has worked great for me.   There is also a slightly modified version below that could be run using iLogic as well.

 

 

Public Sub TurnOffWorkFeatures()

     
   Set Drawing = ThisApplication.ActiveDocument
   
   For Each wp In Drawing.ComponentDefinition.WorkPlanes
      wp.Visible = False
   Next
  
   For Each wa In Drawing.ComponentDefinition.WorkAxes
      wa.Visible = False
   Next
  
   For Each wt In Drawing.ComponentDefinition.WorkPoints
      wt.Visible = False
   Next
  
  End Sub

 

-----------------------------------------------------------------------

iLogic Rule Version

-----------------------------------------------------------------------

   Drawing = ThisApplication.ActiveDocument
   
   For Each wp In Drawing.ComponentDefinition.WorkPlanes
      wp.Visible = False
   Next
  
   For Each wa In Drawing.ComponentDefinition.WorkAxes
      wa.Visible = False
   Next
  
   For Each wt In Drawing.ComponentDefinition.WorkPoints
      wt.Visible = False
   Next
  

Please mark this response "Accept as solution" if it answers your question.
-------------------------------------------------------------------------------------
Corey Parks
Message 3 of 13
Curtis_Waguespack
in reply to: Anonymous

Hi crash_dummy,

 

As coreyparks mentioned you can use an iLogic rule to do this. Below is another code snippet variation that you can paste into a new iLogic rule. This iLogic rule looks at all of the workplanes in the assembly and it's components. It will work if you run it on part files also.

 

If you've not created a rule before, here are a couple of links to help:

http://inventortrenches.blogspot.com/2012/01/creating-basic-ilogic-rule-with-event.html

http://autodeskmfg.typepad.com/blog/2012/01/working-with-external-ilogic-rules.html

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document

'Look at all of the files referenced in the open document
Dim docFile As Document
For Each docFile In openDoc.AllReferencedDocuments                
'format  file name                   
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
Dim docFName As String
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)
For Each oWorkPlane In docFile.ComponentDefinition.WorkPlanes
'toggle all work planes
If oWorkPlane.Visible = True Then
oWorkPlane.Visible = False
ElseIf oWorkPlane.Visible = False Then
oWorkPlane.Visible = True
End If
Next
Next

'look at the workplane collection in the assembly
For Each oWorkPlane In openDoc.ComponentDefinition.WorkPlanes
'toggle all work planes
If oWorkPlane.Visible = True Then
oWorkPlane.Visible = False
ElseIf oWorkPlane.Visible = False Then
oWorkPlane.Visible = True
End If
Next

iLogicVb.UpdateWhenDone = True

 

Message 4 of 13
Anonymous
in reply to: coreyparks

Thanks for the response. I finally had some time to work with your proposal. My large .iam files have many components placed to build the assembly. Each of the components have Work Features associated with them. These get turned on in the .iam file. Your solution works for any Work Feature that was generated in the .iam but not the component Work Features. Could the problem be the ".ActiveDocument" line? Is there a way to recognize the associated "Documents"? Thanks, Dennis Moeller Humanetics Innovative Solutions, Inc. 900 Denton Drive Huron, OH 44839 USA 567-265-3111 dmoeller@humaneticsatd.com
Message 5 of 13
Anonymous
in reply to: Curtis_Waguespack

Thanks for the response. I finally had some time to work with your proposal. My large .iam files have many components placed to build the assembly. Each of the components have Work Features associated with them. These get turned on in the .iam file. I was not able to get your solution to work. I'm not sure if it is my inexperience. Thanks, Dennis Moeller Humanetics Innovative Solutions, Inc. 900 Denton Drive Huron, OH 44839 USA 567-265-3111 dmoeller@humaneticsatd.com
Message 6 of 13
johnsonshiue
in reply to: Anonymous

Hi! I am not sure if you are familiar with Design View. When a component is placed in an assembly, the Design View is set to Master by default. That is why you see all the work features (or objects) show up. In a component (a part or an assembly), you can create a Design View with all existing work planes invisible. Then any newly created work planes will remain visible until you make them invisible.

In the top level assembly, you can simply right-click on any component (containin a non-Master DV) -> Representation -> set it to the desirable DV. Could you try it and see how it works?

Thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 7 of 13
Anonymous
in reply to: johnsonshiue

Thanks for the suggestion. I was not familiar with Design View so I did some quick searching. If I understand it, you physically arrange the model as desired with items visible, etc. Then you save the view. It then can be retrieved later in that same state. For me, this isn't the quick solution I was looking for. If I open a large assembly, all the hundreds of work features are visible. To get to a desired view, I have to manually turn off the features which is VERY time consuming. If more components are added, their features have to be turned off and then the View would then have to be edited. Now if there was a way to add a line to the "Level of Detail : Master" for "All Workfeatures Invisible", that seems to be a viable solution. [cid:image002.jpg@01CE2AC8.0CCAB4C0] Dennis Moeller Humanetics Innovative Solutions, Inc. 900 Denton Drive Huron, OH 44839 USA 567-265-3111 dmoeller@humaneticsatd.com
Message 8 of 13
Anonymous
in reply to: Anonymous

Best bet is good modeling practices and turn off uneeded planes, sketches, etc as you make the parts so once the assembly is done it is clean and clear of clutter.

Message 9 of 13
Anonymous
in reply to: Anonymous

Your suggestion is valid, but not everyone in a large group remembers to do that. If imported files are opened, the same is true. The down side to the suggestion is that if a large sub-assembly is made invisible and then turned back on, all the Workfeatures become visible and the "off" process has to be repeated. There has to be a solution for turning off all Workfeatures, including those in placed components. Being new to Inventor, everyone here just accepts it but to me it's stupid. Autodesk needs to come up with solution because I am sure there are thousands of users who would appreciate it. Dennis Moeller Humanetics Innovative Solutions, Inc. 900 Denton Drive Huron, OH 44839 USA 567-265-3111 dmoeller@humaneticsatd.com
Message 10 of 13
Anonymous
in reply to: Anonymous

Agreed, but until they fix it so any turned off manually stay off until turned back on... I go thru that here as well, as like you said not everyone follows good practices and its quite aggrevating to have 300 workplanes blocking your view and adding new ones becomes almost impossible as you can't see anything. Time for a drafting meeting 🙂

Message 11 of 13
coreyparks
in reply to: Anonymous

This is the reason I never turn work planes on and off for parts while inside of the assembly.  If I need to see a work plane for a part I open the part and turn it on and off there so they don't appear again later,  which is what the code I had posted was for.  The code will only turn off a work plane if you are inside of the file where it was created.  We created this due to one user we had that turned on every work plane in every part in every assembly that he worked on as he liked to work this way, it made all of the preview icons worthless.

Please mark this response "Accept as solution" if it answers your question.
-------------------------------------------------------------------------------------
Corey Parks
Message 12 of 13
Curtis_Waguespack
in reply to: Anonymous

Hi crash_dummy,

 

Here is an updated iLogic rule that will reach down into each subassembly and turn On/Off all workfeatures.

http://inventortrenches.blogspot.com/2013/03/turn-onoff-all-workfeatures-with-ilogic.html 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

On Error Resume Next
Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument  
Dim oDoc As Inventor.Document

'get user input as True or False
wfBoolean = InputRadioBox("Turn all Work Features On/Off", "On", "Off", False, "iLogic")

'Check all referenced docs
For Each oDoc In oAssyDoc.AllReferencedDocuments
    'set work plane visibility
    For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes
    oWorkPlane.Visible = wfBoolean
    Next
    'set work axis visibility
    For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes
    oWorkAxis.Visible = wfBoolean
    Next
    'set work point visibility
    For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints
    oWorkPoint.Visible = wfBoolean
    Next
Next

InventorVb.DocumentUpdate()

 

Message 13 of 13
Anonymous
in reply to: Curtis_Waguespack

Thanks for the info. I tried it on a couple of .iam files and it seemed to work fine. With this and the earlier iLogic code, I am able to turn off ALL Workfeatures in the browser and still be able to construct NEW visible Workfeatures. Dennis Moeller Humanetics Innovative Solutions, Inc. 900 Denton Drive Huron, OH 44839 USA 567-265-3111 dmoeller@humaneticsatd.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report