Jump to content

Recommended Posts

Posted

Hey there. My mates asked me to ask you guys about a LISP or a way to do transversal profiles (the ones created by TopoLT). We have them on paper, and now we have to create them on autoCAD... now you would normally ask me how on earth do we have them on paper, and not on autocad.. well we got them from someone. So we have a drawing (a road , measured and all), with transversal profiles, BUT the profiles are wrong (wrong Z and dist. between points).. AND we got the good profiles, both digitized and printed. So any way to create a lisp that asks for specifi 1st point, you click somewhere, then specify Z for that point, you enter Z, then it asks specify next point distance, you enter the distance, then that point's Z, you enter it, and now you have 2 points, so the LISP can create a line from the direction of the 2.. you need 2 points to create a straight line... and since you now manually entered tose 2, the lisp now only asks for next point distance, and for the point's Z. OR if it would be a little bit easyer, a LISP that reverses the TopoLT profiles... from profile by TopoLT, you put it on to a drawing (so from 2D pls as we have hundreds of profiles that we need to put back into the 3D road..

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • norbi_nw

    9

  • lpseifert

    6

  • rustysilo

    5

  • fuccaro

    2

Top Posters In This Topic

Posted Images

Posted

quick and dirty, not quite ready for prime time...

(defun c:test ()
 (setq pt1 (getpoint "\nPick start point: "))
 (while
   (setq d2 (getdist pt1 "\nEnter horizontal distance to next point: ")
     z2 (getreal "\nEnter elevation of next point: ")
     pt2 (list (+ (car pt1) d2) z2))
   (command "line" pt1 pt2 "")
   (setq pt1 pt2)
   )
 (princ)
 )

Posted

I haven't heard the term transversal profiles before...?

 

You could always just place your profile grid where the lower left corner was at 0,0 then your x value would be your distance/length and the y value would be your elevation. This way you would just use the regular line or polyline command and key in the values. I suppose it would be easiest to do it using relative coordinates. That way you just type in the length and then the relative difference in elevation between points. Quicker with the lisp though for sure.

Posted

Ty for the quick reply, but one question. How do i use this? open a LISP file, replace it's content with this one, and then? and again, THX big time if it works. just don't know how to start it

P.S. transversal... didn't know how to translate it, but it's when you cut something in half, along it's width. (not the lenght)

Again, sorry for the "romanian-english" :P it was hard for me to understand it in romanian, not to mention to translate it :) sry :P

Posted
. transversal... didn't know how to translate it, but it's when you cut something in half, along it's width. (not the lenght)

Over here we refer to them as cross-sections

how to use lisps

Posted

So here's what i really want. The marked polilyne, from picture 1, to the line on picture 2 (so when you look from TOP view, you see a straight, but when you look FRONT, you see it as in picture 1 - so Z and dist between points will remain unchanged).

And thank you for the lisp, testing it, but not fully working in my hands. Also for the tutorial about LISPs, i learned quite alot out of it..

Sometimes the answer is so simple, yet you can't see it :/

page 1.jpg

page 2.jpg

Posted

Do you want to draw a 3D line (including elevations) along the cross-section location in plan view from the info taken from the profile??

Posted

That's what it sounds like to me.

 

It would be pretty awesome if you could go as far as write the lisp to where he could just click the section line in the cross section, tell it what the cl was then select the alignment and it would automatically plot the 3d poly in plan view. I suppose that would take some hefty coding.

Posted

Could you just ask the folks you got the prints from to send you cadd files of it all?

Posted

well we have the CAD files too.. need to find them somewhere :) but it's friday, so workdays are over. still struggling to figure out an easy way.. ty for trying to help.

And yes, cross sections with elevation too.. (thats the Z)

Posted

You are going to build a 3d model with this data it sounds?

Posted

Is this what you're looking for? not extensively tested

(defun c:test (/ begpt endpt zbeg pt1 d2 zval pt2)
 (setvar "cmdecho" 0)
 (setq    begpt (getpoint
       "\nPick start point of cross section location (in plan): "
         )
   endpt (getpoint begpt "\nPick endpoint of cross section: ")
   zbeg  (getreal "Enter elevation of start point: ")
   pt1   (list 0 0 zbeg)
 )
 (command "line" begpt endpt "")
 (command "ucs" "ob" (entlast))
 (entdel (entlast))
 (while
   (setq d2 (getdist pt1 "\nEnter distance to next point: "))
    (progn
      (setq zval (getreal "\nEnter elevation of next point: ")
        pt2  (list (+ (car pt1) d2) 0 zval)
      )
      (command "line" pt1 pt2 "")
      (setq pt1 pt2)
    )
 )
 (command "ucs" "p")
 (setvar "cmdecho" 1)
 (princ)
)

Posted

last lisp is kinda OK, but 1 thing.. we need the points.. your lisp creates the cross section seen from top view, but there are no point with Z's. Now i understand what do we need. we only need the points, that have the right Z elevation.. so about 5-6 points in one line with different elevation, but with different distances between them. (point, as the green circle with the dot in center..). so when we click on the point it will show it's correct Z. Your lisp is ok, but when you switch to front view, you can't select the point (where 2 lines meet - and if i put a circle there, it's z is incorrect). It's no problem if you can't make it, as you showed that you care, and made 2 already.. what we do now is simply look at the drawing from top view, copy a point with a random Z, modify it with what we need (ex. 98.04), then paste it again form 3.42 units away from the first one, with a different Z, then paste again at 4.87 units from second one, change the Z again, and so on. basically no line between them. only a couple of points with Z and a distance between them. your lisp creates a line, but i can't select the point (to check it).. am i missing something?

 

And is there a way to "extract" the X, Y, Z from all the points from a drawing? to MS excell, ot a text file??

Posted

Try this

 

Rescale your dwgs in both x and y to be true scale at 1:1 remove all other line work other than the surface line then simply use rotate3d around x axis this stands up the surface so you now have x,y,z as true values you need to line them up first before rotating so say ch 20 is at y=20 and x is at 0. You may need a datum line depending on your z values to make the rotation simpler.

3d Long section.JPG

Posted

Lpseifert

The running Osnap could make some trouble in your program. I would let it as it is while the user enters points, but before to use the (command "line"...) you should save the OSNAP and set it to zero. And of course, don't forget to restore the saved value.

Also the form (command "._line"...) is preferable.

Well, just my oppinion.

Posted

Thank you again for the developed LISP, and for your help all.. still looking to find a simple way to do it :P

Thx 1000 times. :wink:

Posted

try this, creates points instead of lines

(defun c:test (/ begpt endpt zbeg pt1 d2 zval pt2)
 ;======ERROR TRAP=======

(setq temperr *error*)            
(setq *error* errortrap)            
(setq oldecho (getvar "cmdecho"))        
(setq oldsnap (getvar "osmode"))

 (setvar "osmode" 0)    
 (setvar "cmdecho" 0)
 (setvar "pdmode" 35) 
 (setq    begpt (getpoint
       "\nPick start point of cross section location (in plan): "
         )
   endpt (getpoint begpt "\nPick endpoint of cross section: ")
   zbeg  (getreal "Enter elevation of start point: ")
   pt1   (list 0 0 zbeg)
 )
 (command "line" begpt endpt "")
 (command "ucs" "ob" (entlast))
 (entdel (entlast))
 (command "point" pt1)
 (while
   (setq d2 (getdist "\nEnter horizontal distance to next point: "))
    (progn
      (setq zval (getreal "\nEnter elevation of next point: ")
        pt2  (list (+ (car pt1) d2) 0 zval)
      )
      (command "point" pt2 "")
      (setq pt1 pt2)
    )
 )
 (command "ucs" "p")
 (setvar "osmode" oldsnap)
 (setvar "cmdecho" oldecho)
 (princ)
)



;======ERROR TRAP=======
(defun errortrap (msg)                    
   (setvar "cmdecho" oldecho)                     
   (setvar "osmode" oldsnap)
       (command "ucs" "p")
   (setq *error* temperr)            
   (prompt "\nError...Resetting System Variables ")    
  (princ)
);defun
;======ERROR TRAP=======

Posted
And is there a way to "extract" the X, Y, Z from all the points from a drawing? to MS excell, ot a text file??

 

Maybe try this one. I can't remember where I got it. Probably on here.

 

(defun c:PO2TXT (/ file points c i) ;POints to TeXT 
 (setq file (open (getfiled "specify output file" "c:/" "TXT" 1) "w"))
 (setq points (ssget) i 0)
 (repeat (sslength points)
   (if (= "POINT" (cdr (assoc 0 (entget (ssname points i)))))
     (setq c (cdr (assoc 10 (entget (ssname points i))))
    i (1+ i)
     )
   )
   (write-line
     (strcat (rtos (car c)) " ; "
      (rtos (cadr c)) " ; "
      (rtos (caddr c))
     ) file)
 )
 (close file)
 (Princ)
)

Posted

thank you for the last lisp. I think it works exactly how it should. Now there is a small - in it, that is the regeneration of the drawing at every run. Is there a way to remove it? or is it necesary? thatnk you >:D

 

As for the coordinates to TXT i am still testing it.

Yep, that also works. Hm.. can someone modify it so that it will read circles too? points are ok, but at circles, i get error.

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...