Mirror Feature not working

Mirror Feature not working

tm21915
Contributor Contributor
469 Views
2 Replies
Message 1 of 3

Mirror Feature not working

tm21915
Contributor
Contributor

Hello,

I am trying to mirror pattern, using MirrorFeatureDefinition. However, the command is returning nothing. Attached is my code. I would be really grateful for any help or comment on how to solve this. Or direction towards some other solution.

 

'		Dim oDoc As AssemblyDocument = ThisDoc.Document
		Dim oPDC As Inventor.ComponentDefinition = oDoc.ComponentDefinition
		Dim oFeatures As Inventor.Features = oPDC.Features
		
		Dim oPatternClampse As OccurrencePattern
		oPatternClampse = oDoc.ComponentDefinition.OccurrencePatterns.Item("Clampse80x80")
		Dim oBjPlane As Object = oPDC.WorkPlanes.Item("My_New_Work_Plane") 
	
		Dim oBjColPattern As Inventor.ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
		oBjColPattern.Add(oPatternClampse) 
		
		Dim oMirs As Inventor.MirrorFeatures = oFeatures.MirrorFeatures
		Dim oMirFeatDef As Inventor.MirrorFeatureDefinition
		oMirFeatDef = oFeatures.MirrorFeatures.CreateDefinition(oBjColPattern, oBjPlane)
		Logger.Info("oMirFeatDef = {0}", oMirFeatDef)
		
		Dim oMirFeat As Inventor.MirrorFeature 
		oMirFeat = oMirs.AddByDefinition(oMirFeatDef) 
		oMirFeat.Name = "Testing"

 

0 Likes
470 Views
2 Replies
Replies (2)
Message 2 of 3

jjstr8
Collaborator
Collaborator

In the assembly environment, a MirrorFeatureDefinition would apply to assembly features, however creating assembly features with the API doesn't seem to be supported yet.  Are you trying to mirror the placement of the pattern about the work plane, or are you trying to duplicate the Mirror Components command?

Message 3 of 3

WCrihfield
Mentor
Mentor

I believe @jjstr8 is right.  The regular MirrorFeature is essentially what gets created by the tool found on the 3D Model tab named Mirror.  That is for mirroring either PartFeatures, and/or work features, or SurfaceBodies.  Its internal command is "PartMirrorFeatureCmd".  But the tool on the Assemble > Pattern panel, named Mirror is a different tool.  Its internal command name is "AssemblyMirrorComponentCmd".  You may be able to partially automate it by adding some components to the AssemblyDocument.SelectSet, then executing that command, but that will just show the user interface dialog, and there are several other options that may need to be specified on that dialog that we do not have access to through the API yet.  We can create OccurrencePatterns (RectangularOccurrencePattern, CircularOccurrencePattern, & FeatureBasedOccurrencePattern) by code though.  Otherwise you may just want to copy the component pattern, then use Symmetry constraint(s) on them.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes