cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Basic data types

bjyuen
7-Bedrock

Basic data types

Hi~

 

I want to progamm add-on application of gear hobbing using the CoCreate/SolidDesigner Integration Kit.

But I met some questions about the basic data types in Modeling sofeware environment.

Just like point (gpnt3d or gpnt2d),  direction ,  vector , position , u-vector , gpntwc , etc.

Does anybody could help me to explain them , and what difference between them?

 

Thanks

 

Justin


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
1 ACCEPTED SOLUTION

Accepted Solutions
PeterKehoe
5-Regular Member
(To:bjyuen)

The length of a direction is always 1. (e.g. 1,0,0 or 0,-0.5,0.866)

A vector is essentially a direction and distance. It is expressed as the distance in each of the 3 directions (e.g. 0,10,5 or 1,1,1)

A position is the coordinates in X, Y, and Z, but it can also be thought of as a vector from 0,0,0 to the point.

gpnt3d is the construct for a value with 3 coordinates. This can represent a 3D position (point), a vector, or a direction since all three have 3 values.

gpnt2d is the construct for a value with 2 coordinates. This is normally the 2D coordinates of a point on a workplane.

gpntwc is the construct for when you pick a point in the viewport (if you don't pick on an existing object)

View solution in original post

6 REPLIES 6

Justin,

gpnt3d is the data structure for a 3D coordinate or vector.  This structure can be created from the X, Y, Z values using the make-gpnt3d command and likewise the X, Y, Z values can be read from the gpnt3d structure using the gpnt3d_x, gpnt3d_y and gpnt3d_z commands.

Below is how this might look in lisp code.  This is not tested so forgive me if I typed something in wrong (which is highly likely).

(setf coord (make-gpnt3d :X 23.67 :Y 52.69 :Z 75.23))  ; sets variable coord with x=23.67, y=52.69 and z=75.23

(print coord) ; in case you want to see the coord values in the consule window (to help with debugging)

(setf xcoord (gpnt3d_x coord))  ; sets xcoord to the X coordinate of coord

(setf ycoord (gpnt3d_y coord))  ; sets ycoord to the Y coordinate of coord

(setf zcoord (gpnt3d_z coord))  ; sets zcoord to the Z coordinate of coord

As applied to vectors, the X value is the magnitude in the X direction, etc.

Hopefully this gets you headed in the right direction.

Scott

Thanks to Scott for you explanation !

PeterKehoe
5-Regular Member
(To:bjyuen)

The length of a direction is always 1. (e.g. 1,0,0 or 0,-0.5,0.866)

A vector is essentially a direction and distance. It is expressed as the distance in each of the 3 directions (e.g. 0,10,5 or 1,1,1)

A position is the coordinates in X, Y, and Z, but it can also be thought of as a vector from 0,0,0 to the point.

gpnt3d is the construct for a value with 3 coordinates. This can represent a 3D position (point), a vector, or a direction since all three have 3 values.

gpnt2d is the construct for a value with 2 coordinates. This is normally the 2D coordinates of a point on a workplane.

gpntwc is the construct for when you pick a point in the viewport (if you don't pick on an existing object)

Thanks to Peter for your explanation !

Is the world coordinate (gptwc) dynamic or static in the viewport?

MaxR.Kublin
12-Amethyst
(To:bjyuen)

Thanks to Pete and Scott, the basics of points, vectors etc. have been explained.

My question is: Do you have a IKIT license?

While you can start prototyping in "interpreted LISP", the usual way to develop an add-on application is:

- Develop and test LISP Code

- Finally, use the LISP Compiler to create a DLL (to protect your development)

Our customized LISP code is not compiled.  We use the commands from the Integration Tool Kit to write customization LISP code but we do not have the developer's kit (IKIT) license.

Scott

Top Tags