.ipt Model Sketch visibility in .idw after using pattern in .iam

.ipt Model Sketch visibility in .idw after using pattern in .iam

Reinier
Enthusiast Enthusiast
714 Views
4 Replies
Message 1 of 5

.ipt Model Sketch visibility in .idw after using pattern in .iam

Reinier
Enthusiast
Enthusiast

Hi,

 

A .ipt in my .iam has a sketch which I made visible in my .idw. Now when I make a pattern within my .iam with this particular .ipt, the sketch is not visible in the .idw of the patterned .ipt's. I do not feel like selecting all .ipt's to make the sketch visible. Is there a easier way?

 

Thanks!

 

Reinier

0 Likes
Accepted solutions (1)
715 Views
4 Replies
Replies (4)
Message 2 of 5

johnsonshiue
Community Manager
Community Manager

Hi Reinier,

 

Unfortunately, I am not aware of a solution to do that out-of-box. I think iLogic rule might be able to help. Let me add Curtis to the thread. @Curtis_Waguespack, Do you think iLogic rule can help include visible sketches in patterened components in an assembly view?

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 3 of 5

jhackney1972
Consultant
Consultant

Unless I am do not understand your question, this process is easy but a bit time consuming.  In the drawing, for each element of the pattern, expand in the browser, right click on the part and select "Get Model Sketches".  By the way, this is a one way process, once you include the sketches you cannot not include them, you would have to start the view over again.

 

See Screencast

John Hackney, Retired
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 4 of 5

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @Reinier

 

Here is an ilogic rule per johnsonshiue's suggestion.

 

This rule will:

  • run through the assembly occurrences
  • and if they are a part it adds them to a list for you to select from
  • then it looks in that part and finds all of the sketches
  • and adds them to a list for you to select from
  • once you've selected the part and the sketch within it to work with, it goes back through the assembly 
  • and turns on the visibility of the sketch in each instance

 

 

Notes:

  • due to time constraints, this rule is not written in a very streamlined way, and has not been tested much at all.
  • this rule is not looking at the pattern, so if the selected part file is used in the pattern, and also is used elsewhere in the assembly, the sketch will be turned on in all instances

This is just a "quick and dirty" version of this rule. If you have questions about it, or would like further refinements of it, I would suggest you create a new post on the Inventor Customization forum with a reference link back to this topic:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

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

 

 

 

 

 

create a new ilogic rule in your drawing and paste this in:

 

'start of ilogic code
Dim oDoc As DrawingDocument:  oDoc = ThisDoc.Document
oModel = ThisDoc.ModelDocument

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews


oSheets = oDoc.Sheets

Dim oSSet As SelectSet = ThisDoc.Document.SelectSet
If oSSet.count = 0 Then
	MsgBox("Select a drawing view before running the ilogic rule")
	Exit Sub
End If

'Reference to the drawing view from the 1st selected object
Dim oView As DrawingView = trycast(osset.item(1), DrawingView)

Dim oAssy As AssemblyDocument
If oView IsNot Nothing Then
	oAssy = oView.ReferencedDocumentDescriptor.ReferencedDocument
Else
	Exit Sub	
End If


If oAssy.DocumentType <> kAssemblyDocumentObject Then
    MsgBox("The selected view does not reference an assembly file.")
    Exit Sub
End If

Dim PartList As New ArrayList
Dim SketchList As New ArrayList
Dim oSubOcc As ComponentOccurrence

'get the part to use
For Each oSubOcc In oAssy.ComponentDefinition.Occurrences
	   
   'split occurence name at colon
   oSplit = Split(oSubOcc.Name,":")
   
   'check that list doesn't already contain name
	If PartList.Contains(oSplit(0)) = False Then
		'add name
		PartList.add(oSplit(0))
	End If

Next	

'get user input
sPart = InputListBox("Select a part", PartList, "", "iLogic", "Avalaible parts")

If sPart = "" Then
	MsgBox("Nothing selected.")
	Exit Sub
End If

'get the sketch to use
For Each oSubOcc In oAssy.ComponentDefinition.Occurrences
  
   	'split occurence name at colon
   oSplit = Split(oSubOcc.Name,":")
   
   If oSplit(0) = sPart Then
   
		Dim oSubPartDef As PartComponentDefinition
		oSubPartDef = oSubOcc.Definition		
	
		Dim oSketch As PlanarSketch
		For Each oSketch In oSubPartDef.Sketches
			If SketchList.Contains(oSketch.Name) = False Then
				SketchList.add(oSketch.Name)
			End If
		Next
    End If
Next

'get user input
sSketchName = InputListBox("Select a sketch", SketchList, "", "iLogic", "Avalaible Sketches")

If sSketchName = "" Then
	MsgBox("Nothing selected.")
	Exit Sub
End If

'turn the sketches on
Dim oSketchToUse As PlanarSketch
For Each oSubOcc In oAssy.ComponentDefinition.Occurrences

    If oSubOcc.DefinitionDocumentType =
       kPartDocumentObject Then
	   
	   	'split occurence name at colon
	   oSplit = Split(oSubOcc.Name,":")

	   If oSplit(0) = sPart Then
	   
			Dim oSubPartDef As PartComponentDefinition
			oSubPartDef = oSubOcc.Definition
			
			For Each oSketchToUse In oSubPartDef.Sketches
				If sSketchName = oSketchToUse.Name Then
					Exit For
				End If
			Next
		
		End If		

    End If
	
	Try
		'create sketch proxy in the drawing
		Dim oSketchProxy As PlanarSketchProxy
		Call oSubOcc.CreateGeometryProxy(oSketchToUse,
										oSketchProxy)
										
		'Set Visibility of the Proxy Object 
		Call oView.SetVisibility(oSketchProxy, True)
	Catch
		MsgBox("Error. View might not be normal to sketch.")
	End Try
	

Next
	

 

EESignature

Message 5 of 5

Reinier
Enthusiast
Enthusiast

Hi Curtis_Waguespack,

 

You exactly understand my problem! And you fixed it! I watched your video and I will try it later today. It looks like a complex solution to something I thought to be a small problem. 

 

I did try the following:

A search in my model browser tree within my .idw, searched for the .ipt to select them all at ones to include the sketch. I can find all .ipt's, Inventor will expand the model brower so they are all visible in the model tree, but how do you select all the searched .ipt at ones? This would also be a solution without a rule. Am I right?

 

Thank you so much!

 

Reinier

0 Likes