Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AddFlushConstraint is fhrowing an error "The parameter is incorrect

0 REPLIES 0
Reply
Message 1 of 1
scottmoyse
395 Views, 0 Replies

AddFlushConstraint is fhrowing an error "The parameter is incorrect

I have reposted this here with a more descriptive title:

 

From Malcolm:

 

I have found the answer to the CreateGeometryProxy problem but the AddFlushConstraint is fhrowing an error "The parameter is incorrect.

 

Screen shot attached and the code below.

 

I would realy like some help with ths as it realy holding me up.

 

Regards Malcolm

 

Public

Function ConstrainPart(ByVal oOcc As Inventor.ComponentOccurrence, ByRef oFace1 As Inventor.Face, ByRef oFace2 AsInventor.Face, ByVal Offset AsIntegerAsBoolean' Make sure the occurrence is not grounded.If oOcc.Grounded Then

oOcc.Grounded =

FalseEndIf' Get the component definition of the occurrence. This could be a' part or assembly component definition depending on if the occurrence' is a part or subassembly.Dim oOccDef AsInventor.PartComponentDefinition

oOccDef = oOcc.Definition

' Get the assembly component definition. This assumes the occurrence is' is with respect to the top-level assembly.Dim oAsmDefAsInventor.AssemblyComponentDefinition

oAsmDef = oOcc.ContextDefinition

' Create a proxy for this work plane.Dim oOccFaceProxy As Inventor.FaceProxy = NothingTry

oOcc.CreateGeometryProxy(oFace1,

CType(oOccFaceProxy, FaceProxy))

 

Catch ex AsException

MsgBox(

"Proxy 1 "& ex.Message)

 

EndTry' Create the constraint.Try

oAsmDef.Constraints.AddFlushConstraint(oAsmDef.WorkPlanes.Item(1), oOccFaceProxy, 0)

Catch ex AsException

MsgBox(

"Move "& ex.Message)

 

EndTryTry

oOcc.CreateGeometryProxy(oFace2,

CType(oOccFaceProxy, FaceProxy))

 

Catch ex AsException

MsgBox(

"Proxy 1 "& ex.Message)

 

EndTry' Create the constraint.Try

oAsmDef.Constraints.AddFlushConstraint(oAsmDef.WorkPlanes.Item(2), oOccFaceProxy, Offset)

Catch ex AsException

MsgBox(

"Move "& ex.Message)

 

EndTry

ConstrainPart =

TrueEndFunction

 

To add to and explain malcolms post further, I believe the problem occurs when the user input for selecting the faces is required to constrain to the origin plane. I believe this did worked as a VBA macro, but now the code has been converted over to an Add-in we can't get it to work.

 

Essentially without being able to get this to work, we aren't able to create any addins which require onscreen interaction between the user and components and faces etc..

 

To push forward we really need some help with this either from Autodesk or one of the many programming legends who frequent this forum.

 

cheers


Scott



Scott Moyse
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


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report