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: 

Trying to place custom adaptive part multiple time in a assembly !

6 REPLIES 6
Reply
Message 1 of 7
mecanicu
376 Views, 6 Replies

Trying to place custom adaptive part multiple time in a assembly !

I have an assembly with a reference part (modul testt) and i want to automatic place a custom angle corner (10x10x1mm this is a Sheet metal part) at each edge of the reference part, like a frame.

I made a custom Frame Member with Structural Shape part by copying an existent frame member from DIN Lib and modify in to be a Sheet Metal part + a added a Angel parameter and Corner Bend.

   In the assembly i used Frame Generator to place all custom frame at edges. All my problems start's now. First of all i can't auto align the frame members and i can't modify the angle (the reference model has a random shape and all the faces intersect at odd angles). 

I have try a similar approach with IFeature Parts  but no success.

I'm starting to think my problem needs a ILogic solution, but i don't know were to start.

If someone can help me. I'll much appreciate!

Thank you and excuse my English🙂    

6 REPLIES 6
Message 2 of 7
mecanicu
in reply to: mecanicu

I forgot to put a picture with the final part as an example. Tis is a very time consuming step in my overall project. i need to do this 42 time to finish the project.
I made a rough estimation and i'll need 5 day's of work. Soo any help will much appreciate!!!!
Tx.

Message 3 of 7
A.Acheson
in reply to: mecanicu

Is it possible to attach a sample assembly/part files in a zipped folder that achieves the workflow you want? I don’t think ilogic can help at this stage as you need to finalize the manual workflow first. @CGBenner could you possibly move this post to the Inventor forum as it looks like something @JDMather could possibly assist with? 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 4 of 7
mecanicu
in reply to: A.Acheson

I manage to came up with a code but it made in a part mode

Sub Main()

Dim oApp  = ThisApplication
Dim part As PartDocument = ThisDoc.Document
Dim partDef = part.ComponentDefinition

For Each body As SurfaceBody In partDef.SurfaceBodies
	For Each oFace As Face In body.Faces
		For Each oEdge As Edge In oFace.Edges
			Dim length = oApp.MeasureTools.GetMinimumDistance(oEdge.StartVertex, oEdge.StopVertex)
			'MessageBox.Show("Message: " & length, "Title")

			Dim wp As WorkPlane
			Dim oWkPoint As WorkPoint
    		oWkPoint = part.ComponentDefinition.WorkPoints.AddFixed(oEdge.Geometry.MidPoint)
    		wp = part.ComponentDefinition.WorkPlanes.AddByNormalToCurve(oEdge, oWkPoint)			

			Dim oPlane1 = partDef.WorkPlanes.AddByPlaneAndOffset(oEdge.Faces.Item(1), 0)
			Dim oPlane2 = partDef.WorkPlanes.AddByPlaneAndOffset(oEdge.Faces.Item(2), 0)
			
			Dim oSketch As Sketch
			oSketch = partDef.Sketches.Add(wp)
			
			Dim sEntity1 = oSketch.AddByProjectingEntity(oPlane1)
			sEntity1.Construction = True
			Dim sEntity2 = oSketch.AddByProjectingEntity(oPlane2)
			sEntity2.Construction = True
			
			oPlane1.Visible = False
			oPlane2.Visible = False
			
			Dim point1 = ThisApplication.TransientGeometry.CreatePoint2d(1, 0)
			Dim center = oSketch.AddByProjectingEntity(oWkPoint)
			Dim profileLine1 = oSketch.SketchLines.AddByTwoPoints(center, point1)
			oSketch.GeometricConstraints.AddCollinear(sEntity1, profileLine1)
			
			Dim point2 = ThisApplication.TransientGeometry.CreatePoint2d(-1, 0)
			Dim profileLine2 = oSketch.SketchLines.AddByTwoPoints(center, point2)
			oSketch.GeometricConstraints.AddCollinear(sEntity2, profileLine2)

			 ' Create a path.
    		Dim oPath As Path
    		oPath = partDef.Features.CreatePath(profileLine1)
    
    		Dim oContourFlangeFeatures As ContourFlangeFeatures
    		oContourFlangeFeatures = partDef.Features.ContourFlangeFeatures

    		' Create the flange definition.
    		Dim cfDef As ContourFlangeDefinition
    		cfDef = oContourFlangeFeatures.CreateContourFlangeDefinition(oPath)
    		'set the distance extent
    		Call cfDef.SetDistanceExtent(length, PartFeatureExtentDirectionEnum.kSymmetricExtentDirection)
    		
    		Dim oCF As ContourFlangeFeature
    		oCF = oContourFlangeFeatures.Add(cfDef)

		Next
		Exit For
	Next
Next

End Sub

This code is working but i'm having random errors and has some problems.

-I don't know how to project faces (now i constructed a plane 0 offset from face so i can project it)

 -The line i created is wrong dimension, I would like to create a line from a midpoint, colinear to a projected geometry with a dimension of 10mm.

-Another problem occurs when i iterate throw faces to pick edges (i would like to pick edges directly) now it picks the same edge multiple times + it can pick and newly created edge for generated solids.

- How to set Contour Flange to generate a new solid...

Tank you for your replay  @A.Acheson 

work.jpg

 

Message 5 of 7
mecanicu
in reply to: mecanicu

@CGBenner 

I don't think this move to Inventor Forum is right. I just posted a ILogic solution to my problem. I need some help with that. So pleas move back my post so someone can help me! Tx

Message 6 of 7
A.Acheson
in reply to: mecanicu

@mecanicu  my apologies for the move request you have a good handle on the ilogic side and made good progress. Are you able to do the steps you are looking for manually? Would you have a video of the process? It may be hard for assistance to come in if the process isn’t 100% clear to viewers and you have some sample files to work with as this is specific to the model files. Unfortunately it is outside my skill level working with the assembly so I can only offer assistance to get it moving for more skilled persons to assist. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 7 of 7
mecanicu
in reply to: A.Acheson

No problem. But because I chose the multi body part route and gave up assembly placement. Now the title is wrong.
This code is not specific to any particular case. can be tested on any SheetMetal part that has a solid with straight edges (A cube for example, specify This solid is used as a skeleton)
I decided to go for this one because it gives me more flexibility. I have reached version 2.0 of the code. But unfortunately I don't have the skills to solve the problem on my own, so:
-I don't know how to project a face correctly in a sketch
-I don't know how to draw a line from the center point of the sketch, collinear with the projected line, 10mm long
-I fail to use kNewBodyOperation when I generate new solids and because of this all the generated solids are joined to the skeletal solid.

Tx

 

Sub Main()

Dim oApp  = ThisApplication
Dim part As PartDocument = ThisDoc.Document
Dim partDef = part.ComponentDefinition
Dim bodies = partDef.SurfaceBodies

For Each body As SurfaceBody In bodies
	Dim edges = body.Edges
	For Each oEdge As Edge In edges
		
			Dim length = oApp.MeasureTools.GetMinimumDistance(oEdge.StartVertex, oEdge.StopVertex)
			'MessageBox.Show("Message: " & length, "Title")

			Dim wp As WorkPlane
			Dim oWkPoint As WorkPoint
    		oWkPoint = part.ComponentDefinition.WorkPoints.AddFixed(oEdge.Geometry.MidPoint)
    		wp = part.ComponentDefinition.WorkPlanes.AddByNormalToCurve(oEdge, oWkPoint)			

			Dim oPlane1 = partDef.WorkPlanes.AddByPlaneAndOffset(oEdge.Faces.Item(1), 0)
			Dim oPlane2 = partDef.WorkPlanes.AddByPlaneAndOffset(oEdge.Faces.Item(2), 0)
			
			Dim oSketch As Sketch
			oSketch = partDef.Sketches.Add(wp)
			
			Dim sEntity1 = oSketch.AddByProjectingEntity(oPlane1)
			sEntity1.Construction = True
			Dim sEntity2 = oSketch.AddByProjectingEntity(oPlane2)
			sEntity2.Construction = True
			
			oPlane1.Visible = False
			oPlane2.Visible = False
			
			Dim point1 = ThisApplication.TransientGeometry.CreatePoint2d(1, 0)
			Dim center = oSketch.AddByProjectingEntity(oWkPoint)
			Dim profileLine1 = oSketch.SketchLines.AddByTwoPoints(center, point1)
			oSketch.GeometricConstraints.AddCollinear(sEntity1, profileLine1)
			
			Dim point2 = ThisApplication.TransientGeometry.CreatePoint2d(-1, 0)
			Dim profileLine2 = oSketch.SketchLines.AddByTwoPoints(center, point2)
			oSketch.GeometricConstraints.AddCollinear(sEntity2, profileLine2)

			 ' Create a path.
    		Dim oPath As Path
    		oPath = partDef.Features.CreatePath(profileLine1)
        	Dim oContourFlangeFeatures As ContourFlangeFeatures
    		oContourFlangeFeatures = partDef.Features.ContourFlangeFeatures

						
    		' Create the flange definition.
    		Dim cfDef As ContourFlangeDefinition
    		cfDef = oContourFlangeFeatures.CreateContourFlangeDefinition(oPath)
    		'set the distance extent
    				
			Call cfDef.SetDistanceExtent(length, PartFeatureExtentDirectionEnum.kSymmetricExtentDirection)
    		Dim oCF As ContourFlangeFeature
    		oCF = oContourFlangeFeatures.Add(cfDef)
		
	Next
	Exit For
Next

End Sub

 

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

Post to forums  

Autodesk Design & Make Report