Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parametric Modeling Using Journals

Status
Not open for further replies.

proxima_cygnus

Aerospace
Jun 16, 2023
7
I'm trying to build a model that uses expressions that have x y z variables and create points at each x y z. I have a python script that creates a random number of x y z coordinates and exports it as a .exp file for you to import it as an expression. For example, in the script you can specify n number of points, and it'll generate a random value for x1, y1, z1 ... xn, yn, zn. These are then stored in a .exp file on separate lines, so that when you import the .exp in NX, you'll have expressions x1, y1, z1,... xn, yn, zn in the expressions table. I need to be able to automatically create points using these x y z coordinates, so that every time you edit the python script, you just need to import the .exp file and the model will update with n number of points using the randomized x y z coordinates. I tried using a journal file and edited the code to include a for loop to create each point, but haven't had any success. I'm looking for any tips on how to achieve this, or if there's a better alternative approach. Thanks!
 
Replies continue below

Recommended for you

You can import points via File- Import- points from file.
The problem is "Associativity" and "N Number of Points".
Associativity works such that an object has a ID and it might be dependent on it's own expressions etc.
Example
Object type Point , ID= "abc123", dependent on the expressions : X[sub]abc123[/sub]=100.0 ; Y[sub]abc123[/sub]=50.0 ; Z[sub]abc123[/sub]=0.0

If we have 10 points of the above type in the partfile, and you import new data for 20 points, the difficulty is that the first 10 should map to existing points and move these but the following 10 should create new points.
the first 10 can probably be moved if we import the matching expressions.

I do not know of what happens with / the usage of these points, if the order between the points matter or not.
how should the "next feature" know it should use the new points ?

If you create a spline on point 1; 2; 3; 4 that spline will always start at 1 and end on 4, ( unless you manually re-map the spline) so if you move the coordinates similar to 1;3;2;4, the spline will still pass the points in the "logical" order, 1-2-3-4.

A a workaround, you can create more points than used in the "next feature" ,. but these are included in the proper order, you can suppress the exessive points.

Regards,
Tomas


The more you know about a subject, the more you know how little you know about that subject.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor