Hello, I am trying to set a the part1 reference for a Linear dimension to be only the odd-indexed children of another part. I follow the examples given in help, and the code compiles but gives the error "No such method 'removeIf?'"
Child ToLeftGussets As :IvLinearDimension, Quantity = 3 part1 = nth(removeIf?(even?(Child.index, Model.FrameGusset))) entity1 = "Edge:5" part2 = Model.FrameChannel entity2 = "Vertex:1" textOrigin = funcpointLnrDimOffset((If bTop? Then :Up Else :Down), 1) formattedText = "<DimensionValue/>" dimType = :horizontal centerText? = True arrowheadsInside? = False End Child
Can anyone help or see why this doent work? I am running
Solved! Go to Solution.
Solved by JackGregory. Go to Solution.
I would make something like that.
Child ToLeftGussets As (If odd?(Child.index) Then :IvLinearDimension Else :NullDesign), Quantity = 3 part1 = nth(Child.index, Model.FrameGusset) entity1 = "Edge:5" part2 = Model.FrameChannel entity2 = "Vertex:1" textOrigin = funcpointLnrDimOffset((If bTop? Then :Up Else :Down), 1) formattedText = "<DimensionValue/>" dimType = :horizontal centerText? = True arrowheadsInside? = False End Child
It is an odd error message, and I consider that a defect, but I think it doesn't recognize the call to removeIf? with one argument. And, actually, even? with two arguments should probably error as well. I will investigate the error handling here.
removeIf?(even?(Child.index, Model.FrameGusset))
I looked into this, and we have a documentation bug that I think is causing the confusion. The answer is, there is actually no function removeIf?, just like it says. There is documentation for such a function, but you might notice in the examples shown in the documentation, the function actually being called is removeIf, without the question mark. This makes sense, since we only use the ? on a function name if it returns a boolean, and this function returns a list.
Also, the first argument must be the Name of a function. So you need :even?
So I will get the documentation corrected. Thanks for finding this.
As a side comment, hard-coding the quantity, and then applying a function that returns a list is a bug waiting to happen. The quantity should be based on the list length. Pulling these out into a rule would make it a lot clearer. Then quantity could be the length of the list produced from the removeIf function, and the nth(child.index, <list>) would be pulling from a list that is guaranteed to be of the same size as the quantity.