A little help assigning points to end points or intresections

A little help assigning points to end points or intresections

Anonymous
Not applicable
1,107 Views
11 Replies
Message 1 of 12

A little help assigning points to end points or intresections

Anonymous
Not applicable

I am developing a series of lisp routines and want to associate the points (setq pt1 (???),(setq pt2 (???) etc.) to the corners of a 3d cube. I understand prompting for the user click (getpoint) The idea is so when I stretch or manipulate the cube size, the assigned points remain attached to the corners of the cube.

Any help would be appreciated,

Thanks Guy

0 Likes
1,108 Views
11 Replies
Replies (11)
Message 2 of 12

john.uhden
Mentor
Mentor

Please help us make sure we are understanding you correctly.

 

Okay, so there are 8 corners to a cube, right?  And for programming reasons you want to store their coordinates in symbol names p1, p2, p3, etc., right?

 

Then you mention stretching the corners to maybe a tetrahedron or truncated pyramid or something.  But do you want to maintain the original coordinates for some purpose?  If so, would that be within one editing session or maybe more?  Or, do you wish to have the symbol values updated with every stretch or move, or scale, or rotate?

 

Seems to me that if the latter is the case, then there is no need to save them anywhere since you can just retrieve their latest values, unless the cube gets mirrored maybe and the points would come out in a different order that makes a difference.

 

Perhaps you need to explain the entire purpose/goal.  I dunno, but f'rinstance maybe the cubes are column foundations and their geometry affects the column and beam design.  None of us here wants your Grand Slalom roller coaster ride to come apart because of a faulty lisp routine.  I doubt that we could Undo the injuries.

John F. Uhden

0 Likes
Message 3 of 12

Anonymous
Not applicable

Okay, a little more info, the lisp is used to erect scaffolding in 3d model space. Blocks (specific scaffold pieces) are inserted and copied and/ or moved to form a scaffold, based on the points selected by the user. Right now the user picks pt1 and pt3 (corners of a rectangle or square in 2d plane) then they are prompted to pick a third selection pt5 which represents the height.

  From this information the lisp routine develops the other points needed and inserts the appropriate length material etc into the proper positions.

  This actually works quite well but I wish to improve on the concept by having the points assigned to the corners of the cube, so when the length is changed in any direction the lisp will re-evaluate, ._undo and repopulate.

 So, no other odd shapes, will always be a cube, just changing width, length and height to fit specific locations in Navis works space.

I want the coordinates to update as the cube is changed. A user may change the shape of the cube several times until the scaffold fits where he needs it.

thanks

Guy

0 Likes
Message 4 of 12

john.uhden
Mentor
Mentor

I need some time to digest that, plus I'm trying to watch the Superbowl, and my wife has made a superb meal which we shouldn't delay.

I and I'm sure many other smarter people here will be looking this over tomorrow or soon thereafter.  We don't want any scaffolding falling down either.

John F. Uhden

0 Likes
Message 5 of 12

Anonymous
Not applicable

No worries, John. To re-cap. I want to learn how to create a point (pt1 for example) that is tied to an end point of a line or corner of a cube so when that end or corner is moved the point moves with it.

Thanks in advance for any help

Guy 

0 Likes
Message 6 of 12

john.uhden
Mentor
Mentor

I may be way off base here, but it seems to me that you should design the scaffolding first and then position the foundation cubes under the columns, no?

John F. Uhden

0 Likes
Message 7 of 12

Anonymous
Not applicable

Sorry , I am not explaining clearly. no foundations, nothing like that. I simply need to learn if I can assign the points to the end-point of a line  or intersection (corner of a cube)

0 Likes
Message 8 of 12

john.uhden
Mentor
Mentor

Okay.  Sorry for the meddling.

There are a number of ways to get points. For example:

(setq p1 (getpoint))

(setq p1 (cdr (assoc 10 (entget (car (entsel))))))

(setq p1 (vlax-get object 'startpoint))  ;; you have to set the object first.

(setq p1 (vlax-curve-getpointatparam object param))  ; you ned to set the object and param first

(setq p1 (osnap p "end"))  ;; where p is a point near an edge/side/segment of the object of interest.

 

I am not familiar with the properties of a cube, but once you get the entity data you can check out the help for DXF codes, or

you can convert the ENAME into a VLA-OBJECT and use (vlax-dump-object) to see a list of its available properties and applicable methods.

 

I am still wondering how you intend to use the points you extract.  Once the cube is altered, the points you had saved are where the cube was, not is.

Extracting the fresh data is super fast, so there may be no need to know where the cube was.

John F. Uhden

Message 9 of 12

Anonymous
Not applicable

ok I'll try this again. I replied but did something wrong,

No apology needed for the "meddling" it's how we form mental pics and maybe think of a new route to the same place.

 

cube.PNG

okay so you recognize what I have been calling the cube in this picture, it's a box in autocad. how my lisp works right now is... user picks on the points in the picture first prompted to pic bottom left corner footprint (they pick "pt1"), then prompted to pic top right corner of footprint (they pic pt3), then prompted to pick deck height (they pic pt5). My lisp routine develops pt2 and pt4 and inserts the proper pieces to create the next photoscaffold.PNG

works quite well. I want to improve on this and make it easily modifiable. simply activate the box

cube active.PNG

 

 

resized cube.PNG

as shown in this photo. drag to a new size

 

new cube.PNG

 lisp would  delete back to an undomark

 

new size scaffold.PNG

 

re assign new coordinates to pt1 based on car,cadr, and caddr of new endpoint of "named entity" and run through lisp again to get this.

I am thinking that if I create a named entity then create a reactor triggered by a change in size, the reaction can be undo back to mark, and run through lisp again. The assignment of pt1 could be the car,cadr,caddr of endpoint of"named entity" in the code so after undo to mark, when it runs through the lisp it will pick up the new values.

Am I on the right track or would you have a suggestion as to how to accomplish this.

0 Likes
Message 10 of 12

john.uhden
Mentor
Mentor

It would help if I knew what kind of object the "cube" is.  I am really not much of a 3D person.  I suppose it could be an extruded polyline, but I dunno.  Or maybe a polyline with thickness.  If it's something like that, and if any two opposite corners are enough to define the base, then just knowing the entity makes it all easy.  We could calculate the centroid of the top face, etc.

John F. Uhden

Message 11 of 12

Anonymous
Not applicable
In acad 3d the command is box. I belive it is essentially an extruded rectangle.
0 Likes
Message 12 of 12

john.uhden
Mentor
Mentor

That's too bad.  I am pretty much lost looking at both the entity data and vla properties of an AcDb3dSolid.  But there are many smarter people here that will hopefully jump in to help.

John F. Uhden

0 Likes