i get an error saying "The parameter is incorrect"

i get an error saying "The parameter is incorrect"

mfaghan2UMTG
Explorer Explorer
319 Views
2 Replies
Message 1 of 3

i get an error saying "The parameter is incorrect"

mfaghan2UMTG
Explorer
Explorer
i can run my rules with no Errors but when i try to creat my ipt, i get an error saying my rule is incorrect 


Dim
oDoc As PartDocument oDoc = ThisApplication.ActiveDocument Dim oCompDef As SheetMetalComponentDefinition oCompDef = oDoc.ComponentDefinition Dim oiMate As iMateDefinition For Each oiMate In oCompDef.iMateDefinitions If InStr(oiMate.Name,"Stud") Then oiMate.Delete() End If Next Dim oFeature As PartFeature For Each oFeature In oCompDef.Features If InStr(oFeature.Name,"Bushing") Then Dim oFace As Face For Each oFace In oFeature.Faces Dim oEdge As Edge For Each oEdge In oFace.Edges Dim oCurveEval As CurveEvaluator = oEdge.Evaluator Dim MinParam As Double Dim MaxParam As Double oCurveEval.GetParamExtents(MinParam, MaxParam) Dim length As Double oCurveEval.GetLengthAtParam(MinParam, MaxParam, length) Dim MidParam As Double oCurveEval.GetParamAtLength(MinParam, length * 0.5, MidParam) Dim Params() As Double = {MidParam} Dim Points(2) As Double oCurveEval.GetPointAtParam(Params, Points) If length = (.875 in * PI*2.54) And Points(2) = Thickness * 2.54 Then Dim strMatchList(0) As String strMatchList(0) = Left(oFeature.Name,2) Dim oInsertiMateDefinition As InsertiMateDefinition oInsertiMateDefinition = oCompDef.iMateDefinitions.AddInsertiMateDefinition(oEdge, True, 0 , , Left(oFeature.Name,2) & " Stud", strMatchList) 'oInsertiMate = oCompDef.iMateDefinitions.AddInsertiMateDefinition(oEdge, True, 0, , Left(oFeature.Name,2) & " Stud",strMatchList ) End If Next Next End If Next
0 Likes
320 Views
2 Replies
Replies (2)
Message 2 of 3

MateriaGris
Contributor
Contributor

Hi @mfaghan2UMTG, how are you?

I don't know what characteristics your model has or what operations make it up, I made a proposal assuming that the searched operation is a hole and the code worked without problem.
I share the file.

Maybe you can share more information about your part file in order to help you.

0 Likes
Message 3 of 3

mfaghan2UMTG
Explorer
Explorer

i think there is something wrong with my Ipt since your code works. when i go to sketch's face and exit, i will get an error. i have attached my box 

0 Likes