Jump to content

Recommended Posts

Posted

hi there,

i need to create a 3d polyline from either a 2d line or 2d points with elevation text.

 

I would like to be able to snap to the end.vertice of a line and be prompted for the elevation of the 3d polyline..then continue drawing until i am finished. ( A great command for creating 3d road channels/surfaces etc.)

 

Another cool command would be to send a 2d line/polyline to a userdefined specific elevation and/or elevation offset. (this would be a cool command for creating models from 2d contours.)

 

Anyone know of anything like tis available?

 

cheers

iain

  • Replies 34
  • Created
  • Last Reply

Top Posters In This Topic

  • iain9876

    12

  • eldon

    8

  • kpblc

    7

  • matt27

    2

Top Posters In This Topic

Posted

You can just change elevation of lightweightpolyline through properties window of any another way you like. Is it enough?

During draw 3dpolyline define coordinates like

0,0,500

200,200,550 etc

Posted

Thanks for replying, I am aware of the x,y,z coordinate system but that involves entering all the coordinates which can be time consuming.

 

What I am talking about is creating a 3d plan drawing from 2d. the lines or points have already been drawn.

 

What i would like it to be able to do is to snap to a point, then be prompted for an elevation for that point then proceed to draw my polyline in 3d, being prompted for an elevation at each vertex until the the whole line has been drawn.

 

Similarly if there were text next to the 2d line giving a numerical elevation (say from a topographical survey given in 2d but with shown elevation text) ...be able to click on the 2d line, then click on the elevation text and they would automatically be forced to that level...then continue the same for the other vertices.

 

I know these are two separate ways.

Posted

It is certainly possible. I have had 2d drawings which I need to convert into a ground model, so I wrote a lisp routine in which the plan point was selected then the level text was selected to give the elevation and the output was a 3d point. One advantage is that you do not have to zoom in to see the actual text, just click on the blob and you can work on a much larger area than when you need to read the text.

 

Then a 3d polyline could be drawn by connecting up the points.

 

My lisp skills are so basic, with no error trapping at all, that I would be embarrassed to publish them. They work for me in my setup, but I doubt they would work anywhere else.

 

I am sure that there others who could write the lisp routine so you could work as you want to.

Posted

thanks eldon, I think I'll start to learn lisp!.. can you recomment a good book?

Posted

:unsure: Now that is a leading question!

 

I taught myself by looking at lisp routines and trying to follow what they were trying to do, and looking in the customization guide to see what the commands were.

 

Your brain cells need to be aligned a certain way to understand it all, but the best of luck.:)

Posted

All right. Explain me please the technology of your working:

1. Selecting the point (start point of new 3dployline)

2. Entering new elevation

3. Select next point

4. Enter new elevation

etc

Right? Or not?

Posted

Hi again,

The steps would be as follows;

 

The manual way (no elevation text present in the drawing)

1. Select the point (start point of new 3dployline)

2. Entering new elevation

3. Select next point

4. Enter new elevation

5. carry on until finished

 

Another good way would be to do as follows;

 

The semi-automated way (elevation text is present in the drawing)

1. Select the point (start point of new 3dployline)

2. select the elevation text

3. Select next point

4. select new elevation text

5. carry on until finished

 

cheers

iain

Posted

Before the professionals get to work on lisp, I re-read your initial post about sending a 2d polyline to an elevation. Use the command MOVE.

 

Choose the object and when you need to specify the base point, just click anywhere in the drawing, then for the second point of displacement type @0,0,elevation where elevation is the required amount.

 

Do you want to PM me and I can send what lisp I have, to see if that will get you on your way?

Posted

iain

I would suggest you upload a sample drawing with a before and after of what you are trying to accomplish.

This will give the folks here a better idea of how to help you.

Posted

O.K. iain, here is my lisp routine which draws points at the x,y of endpoints of lines and intersections, with the z value from the written text.

 

 
(defun c:grlev ( / p1 tx e zd os); puts 3D point at level shown by text
(setvar "OSMODE" 33); sets osnap to endpoint & intersection
(setq p1 (getpoint "\n Pick plan point..... "))
(setq os (getvar "OSMODE"))
(setvar "OSMODE" 64)
(setq tx (entsel "\n Pick Level text...... "))
(setvar "OSMODE" 0)
(setq e (entget (car tx)))
(setq zd (atof (cdr (assoc 1 e))))
(setq p1 (list (car p1) (cadr p1) zd))
(command "point" p1)
(setvar "OSMODE" os)
)

 

It does work but does not loop, but by right clicking the mouse, it repeats the command and you can create 3d points very quickly. Then you have to draw your 3D polyline using these points.

 

If I want to change the osnap, I edit the lisp file - that is the level of my lisp.

Posted

Upload a drawing?... I guess I could, all i was asking was to draw 2d polylines to 3d...by specifying the vertex elevation at the command prompt (or even by selecting the elevation text), the x, and y coordinate would be chosen by snapping to a point.....

 

Anyone else not get it??

Posted

Many thanks Eldon,

 

Tried out the routine, it draws the node at the correct elevation, then you draw a polyline on these points.

I couldn't get the polylines to snap to the nodes exactly for some reason....

 

lets see if Kbplc can come up with a routine that draws the polylines straight from the text, and/or user input.

 

Did you see the one he wrote for the low points on a 3d polyline?...

 

Thanks again

iain

Posted

Just one or two thoughts to try - have you got the osnap set only to NODE? Can you freeze all other layers so you only have the points showing and your 3d polyline? Are you using the 3DPolyline command?

 

Best of luck with the 3D Polylines. I gave up on them when I found you could not join one with another as you can with ordinary polylines with polyline edit.

Posted

Hi Jochen,

 

Thank you very much for that link.

 

I now try and organise myself so that I can draw a 3Dpolyline in one go, but it's nice to know a backup.

Posted

Why not just use the built in .xy input filter? -David

Posted

The built in .XY filter is the way to do this manually.

 

However, you have to read the level text, then enter this value correctly and with lots of points, the error potential is there. Far better to let lisp read the level text for you.

 

I could never find a way to keep the .XY filter on. I had to set it at every point unlike the OSNAP which was set at the beginning. With a large drawing in need of being turned into a ground model, it provided the impetus to learn a bit of lisp.

Posted

I wonder if KPBLC has any thoughts on this.

Posted

I'm sorry - i had to reinstall Windows, AutoCAD etc. Try this code:

(defun c:3dp (/ adoc pt_prev h_prev pt_lst vla_pline vla_pt_lst answer)
;;; Written by kpblc at 2006 Oct 11 by req of iain9876
;;; at cadtutor.net forum 
 (vl-load-com)
 (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
 (vla-startundomark adoc)
 (if (setq pt_prev (getpoint "\nSelect start point <Exit> : "))
   (progn
     (setq
       h_prev (cond
                ((setq h_prev
                        (car
                          (entsel
                            (strcat
                              "\nSelect the TEXT (or MTEXT) to get elevation <"
                              (rtos (caddr pt_prev))
                              "> : "
                              ) ;_ end of strcat
                            ) ;_ end of entget
                          ) ;_ end of car
                       ) ;_ end of setq
                 (atof
                   (vla-get-textstring (vlax-ename->vla-object h_prev))
                   ) ;_ end of rtos
                 )
                (caddr pt_prev)
                ) ;_ end of cond
       pt_lst (list (list (car pt_prev) (cadr pt_prev) h_prev))
       ) ;_ end of setq
     (while (setq cur_pt (getpoint pt_prev "\nSelect next point <Enough> : "))
       (setq pt_prev    cur_pt
             h_prev     (cond
                          ((setq h_prev
                                  (car
                                    (entsel
                                      (strcat
                                        "\nSelect the TEXT (or MTEXT) to get elevation <"
                                        (rtos (caddr pt_prev))
                                        "> : "
                                        ) ;_ end of strcat
                                      ) ;_ end of entget
                                    ) ;_ end of car
                                 ) ;_ end of setq
                           (atof
                             (vla-get-textstring (vlax-ename->vla-object h_prev))
                             ) ;_ end of rtos
                           )
                          (caddr pt_prev)
                          ) ;_ end of cond
             pt_lst     (append pt_lst
                                (list (list (car pt_prev) (cadr pt_prev) h_prev))
                                ) ;_ end of append
             vla_pt_lst (vlax-make-variant
                          (vlax-safearray-fill
                            (vlax-make-safearray
                              vlax-vbdouble
                              (cons 1 (length (apply 'append pt_lst)))
                              ) ;_ end of vlax-make-safearray
                            (apply 'append pt_lst)
                            ) ;_ end of vlax-safearray-fill
                          ) ;_ end of vlax-make-variant
             ) ;_ end of setq
       (if (not vla_pline)
         (setq vla_pline (vla-add3dpoly (vla-get-modelspace adoc) vla_pt_lst))
         (vla-put-coordinates vla_pline vla_pt_lst)
         ) ;_ end of if
       ) ;_ end of while
     (initget "Yes No _ Y N")
     (if (= (cond ((getkword "Close it [Yes/No] <Yes> : ")
                   )
                  (t "Y")
                  ) ;_ end of cond
            "Y"
            ) ;_ end of =
       (vla-put-closed vla_pline :vlax-true)
       ) ;_ end of if
     ) ;_ end of progn
   ) ;_ end of if
 (vla-endundomark adoc)
 (princ)
 ) ;_ end of defun

---

Added:

I forgot to say: testing of entity type where from lisp should get textstring is not provided! Be careful!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...