I'm trying to create a journal-based feature that will create a Load (force-by-components) in the given point.
When I record the operation there is a "sticky" line in it with the point definition:
Dim point1 As Point = CType(component1.FindObject("PROTO#.Points|ENTITY 2 4 1"), Point)
The point itself is created in the .fem file so it cannot be chosen directly, however it is given a meaningful name.
How do I get the FinObject to pick the point by its name attribute?
Working with NX9, journal language is Visual Basic.
Thanks in advance.
Solved! Go to Solution.
I have had a similar problem. I my case I know the coordinates of the point. With this information I could obtain the point and thus also the "object". Then it was easy to create a force on the object (which is what you recorded).
I have attached my journal file CreateLoadOnPoint.vb, but I had to rename it to .txt to work.
SInce you have the name of the point, maybe you can update the function GetPoint to look for a match in name instead of coordinates. And then also return the journalidentifier.
btw: Findobject is very often used in journaling, but you should avoid it in your own code. Unfortunately it is not always that straightforward to do...
Hope this helps.
In this case, you probably need to iterate through all of the points in the SIM part. If the SIM point is an occurrance, get its prototype (which should be the FEM part point) and check the name of the prototype. If you find a match, then the SIM part point is the one you are looking for.
Frvanhee, thank you so much, this is exctly what I needed (specifically - the item.journalidetifier feature). Function GetPoint can be easily redefined to check the item.Name.
One small remark. I've noticed that you use some custom group, named 'AllPoints" to get to the points in the FEM part. I presume you create that group earlier in the FEM part. May be a little more elegant way to do this is to declare the FEM part variable by, say
Dim mainFemPart As CAE.FemPart = workSimPart.FemPart
and instead of creating the special variable Group1 just look for the needed point within mainFemPart.Points
I know one should not use the FindObject in the code, but I think, when you have to use something that was created earlier (not defined in the current code and especially not created in the current work part) this can't be avoided.
Thank you all again for your help.