Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NX GRIP Print ENTITY data

Status
Not open for further replies.

miike110

Mechanical
Sep 24, 2019
2
0
0
US
thread561-221594

How do you print whatever is inside the entity?

print/myEntity(index) doesn't work

I am trying to debug a .grs program which calls several other .grs programs into memory.
One of the arguments passed into the .grs file that I am attempting to debug is myEntity.
There is a part in the program where a variable is set to a point/&spoint(myEntity(index))

I'd like to access whatever is being passed into the &spoint (start point) in order to make sure the correct data is in there.

Thank you!
 
Replies continue below

Recommended for you

Since that thread was never finished, not sure what that poster was looking for.

What are you looking for?
myEntity is an array, defined in the program code.
index is an entry into the array.
Depending on how the array is defined, that will get you the data type.
Index will get you the values from the array once you know the type and index value.

The array could be 1 dimensional, or 2 dimensional. 1 dimensional would be a single X, Y, Z point. 2 dimensional would be multiple points. in the same data statement.


"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli
 
In my case, "index" is being declared as a number type, yet I don't see it being set to anything.

It is referenced several times in Program Loops where:

Code:
do/LOOP1:,index,1,total_index

Anyways,

There is a line in .grs code that creates a point using an element from within the Entity array.
Code:
myPoint = point/&spoint(myEntity(index))

Can you help me write a block of code to output what is being passed into the point creation?
Code:
print/myEntity(index)
doesn't work.

The Entity is defined as a tag_t object on the C++ side. It is passed into the .grs file as a grip argument.

When I print out myEntity(index) on the C++ side inside a loop (before it gets passed into the .grs file as a grip argument), it shows 5 numbers that increments by 1 at the end of each loop.

However, each time I run the program, those 5 numbers change in the sequence of looping operations.

For example the first 10 sets of 5 digit numbers in one instance of running the program will not match the second 10 sets of 5 digit numbers when I re-run the same program (the tag_t object is set to a NULL_TAG inside a For Loop, so I'm guessing it's collecting some kind of data that changes in memory)





 
Hi Miike110,

At the beginning of the GRIP subroutine/program add a declaration for an array of 3 numbers to accept the data from the startpoint (&spoint) information of entity "myEnitity". The array is named "N". Change the name if this causes conflicts.

Code:
ENTITY/myEntity(5)
[b]Number/[highlight #FCE94F]N[/highlight](3)[/b]

Replace the "print/myEntity(index)" with the following lines to display the 3 values that are extracted from the entity.

Code:
print/'Index = ' + istr(index)
print/'Type = ' + istr(&TYPE(myEntity(index)))
[highlight #FCE94F]N[/highlight]=&SPOINT(myEntity(index))
print/fstr([highlight #FCE94F]N[/highlight](1))
print/fstr([highlight #FCE94F]N[/highlight](2))
print/fstr([highlight #FCE94F]N[/highlight](3))

Hope this helps,

Joe
 
Status
Not open for further replies.
Back
Top