Jump to content

Recommended Posts

Posted

Being lazy as i am, and having done this a bazillion times, my brain says why not ask those that know if it is possible...

 

So, we generate cross sections from very dodgy architects/landscape/civil engineers/ blokes called Bob etc drawings sent in for quotes...

Quality of drawings we are sent can range from beer mat to Picasso.... 

 

Now then,  we arrange the dodgy levels along the datum line, draw short polylines and stretch north wards by given a level, then join together to form a ground profile.

 

My question is... would it be possible to create a lisp that we can use were we select a polyline along the datum line and then select the text adjacent and it would extend the polyline north of the datum line by the text amount ??

Polylinelisp.dwg

Posted

I think this is something that Civil3D covers -  BigAl knows these things better than me though.

 

 

This is a very quick and dirty LISP: 

Noting that your lines are 1000x longer than the reference texts, I have a multiplier (hit enter to just accept the 1000, you can change the code to suit)

Select the reference polyline - I am assuming always a horizontal reference line as your example

Select the point that the height texts refer to (is it the centre of the '+', in the drawing there is a point drawn at the correct height next to each text) and then the associated text.

Repeat along the points

Exit badly with the escape key. I am going to get abuse for cutting corners there...

 

Slight difference to your example that my lines are drawn from the closest point on the polyline that you selected

 

(defun c:test ( / Multiplier ReferencePoly ReferenceY EndLoop MyPoint MyHeight MyHt ClosestPoint)
  (defun MkLn ( pt1 pt2 Layer / Ln ) ;; Add in layer etc details
    (setq Ln (entmakex (list
      '(0 . "LINE") '(100 . "AcDbEntity") '(410 . "Model") '(62 . 0) '(100 . "AcDbLine")
      (cons 8 Layer)
      (cons 6 "CONTINUOUS")
      (cons 62 256)
      (cons 10 pt1)
      (cons 11 pt2)
      '(210 0.0 0.0 1.0)
    ))) ; end list, entmakex, setq
  )
  
  (setq Multiplier (getreal "Enter Height Multiplier (1000)"))
  (if (or (= Multiplier nil)(= Multiplier "")(= Multiplier 0))
    (setq Multiplier 1000)
  )
  (setq ReferencePoly (car (entsel "Select Reference Polyline")))
  (setq ReferenceY (cdr (assoc 10 (entget ReferencePoly))))
  (setq EndLoop "No")
  (while (= EndLoop "No")
    (setq MyPoint (getpoint "Select Point"))
    (setq MyHeight (car (entsel "Select Height text")))
    (setq MyHt (cdr (assoc 1 (entget MyHeight))))
    (setq ClosestPoint (vlax-curve-getclosestpointto ReferencePoly MyPoint))
    (MkLn ClosestPoint (mapcar '* '(1 1 0) (mapcar '+ (list 0 (* Multiplier (atof MyHt)) 0) ClosestPoint)) "0")
  )
)

 

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