Type mismatch error

Type mismatch error

Anonymous
Not applicable
533 Views
2 Replies
Message 1 of 3

Type mismatch error

Anonymous
Not applicable

I am trying to create a circular pattern of a hole feature in an assembly with ilogic but i get a type mismatch error. Can anyone see what i am not seeing???

 

oDoc=ThisApplication.ActiveEditDocument

oHole= ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyFeatureFilter, "Select a hole feature")
		
oaxis = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllCircularEntities, "Select a hole circle edge")
Dim amount As Object = 4
Dim angle As Object = 360 * 180 / 3.14

circularPatternDef=oDoc.ComponentDefinition.Features.CircularPatternFeatures.CreateDefinition(oHole,oaxis,False,amount,angle,True)
		
Dim circularPat As CircularPatternFeature =oDoc.ComponentDefinition.Features.CircularPatternFeatures.AddByDefinition(circularPatternDef)

  

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

Sergio.D.Suárez
Mentor
Mentor

Hi, try with this code. There were some mistakes. For start the axis entity must be linear. On the other hand you have to specify a collection of objects to make the pattern in your case there is only one.

 

oDoc=ThisApplication.ActiveEditDocument

Dim objCol As ObjectCollection
objCol = ThisApplication.TransientObjects.CreateObjectCollection
oHole= ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyFeatureFilter, "Select a hole feature")
objCol.Add(oHole)

oaxis = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllLinearEntities, "Select linear center edge")
Dim amount As Object = 4
Dim angle As Object = 360 * 180 / 3.14

'create pattern
Dim circularPat As CircularPatternFeature = oDoc.ComponentDefinition.Features.CircularPatternFeatures.Add(objCol, oaxis, False, amount, angle, True)

 I hope the code is useful for solving your problem. regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 3 of 3

Anonymous
Not applicable

Thanks for the code and fast reply

It creates a circular pattern with an error.

When i checked the health status of the circularfeature  i get this status:

 

kDriverLostHealth11780Object is driven by data from other Object(s), and one or more of them have been disconnected.

 

Is there a way to correct this error??

0 Likes