Jump to content

Measure block along polyline with specify lengths


Recommended Posts

Posted

Hello;

 

I need a Lisp that will measure blocks along polyline by specify length

(The length should always calculate from 0, beginning of polyline)

 

Eample:

Drawing unit is in Meter

I have a Road center line of 10Km (10000m), if i enter length 3300m block should place at 3300m

if i enter length 5600m block should place at 5600m

 

Many thanks

Siva

cadtutor123.jpg

Posted

Hi,

 

What is the name of the Block?

What about the rotation of the block?

Is it attributed block?

Posted (edited)

Hi;

 

Block name is CATCH_PIT with one attribute as shown

Rotation is Perpendicular to alignment of the Road, as i attached dwg

 

catchpit location.jpg

 

cannot able to attach file size is more than 1MB

 

thanks

Siva

cadtutor45.jpg

Edited by sivapathasunderam
added clear image
Posted

This exercise is to place CATCH_PIT BLOCKS with specific chainages along polyline (Road Length is 36.6Km)

Posted

What about the value of the attribute ? Will it be asked to the user to enter or is it a static value ?

Posted

Yes, it will ask the user to enter (it varies)

Posted (edited)

Try this draft and let me know.

 


(defun c:Test  (/ blk s e l d v)
 ;; Tharwat 07.Feb.2016 ;;
 (setq blk "CATCH_PIT")
 ;; Block name
 (if (and (tblsearch "BLOCK" blk)
          (princ "\nSelect LWpolyline :")
          (setq s (ssget "_+.:S:E" '((0 . "LWPOLYLINE"))))
          (setq l (vlax-curve-getdistatpoint
                    (setq e (ssname s 0))
                    (vlax-curve-getendpoint e))))
   (while
     (and
       (setq d
              (getdist
                (strcat "\nSpecify distance less than "
                        (rtos l 2 2)
                        " > :")
                )
             )
       (< d l)
       (/= "" (setq v (getstring t "\nSpecify Attribute Value :")))
       )
      (entmake
        (list '(0 . "INSERT")
              (cons 10 (vlax-curve-getpointatdist e d))
              (cons 50
                    (+ (* pi 0.5)(angle '(0. 0. 0.)
                           (vlax-curve-getfirstderiv
                             e
                             (vlax-curve-getparamatpoint
                               e
                               (vlax-curve-getpointatdist e d))))))                     
              (cons 2 blk)
              )
        )
      (if (> d l)
        (alert "\nLong distance entered !")
        )
      )
   )
 (princ)
 )(vl-load-com)

Edited by Tharwat
Posted

Great Job, but the only thing is it's place the block parallel to Alignment as shown

 

tutor.jpg

Posted
Codes updated above , try again.

 

Excellent work Tharwat!

I really appreciate it.

 

I search the google for more than 5 hours couldn't get any thing

 

Thanks for the help!

Siva

Posted
Excellent work Tharwat!

I really appreciate it.

 

I search the google for more than 5 hours couldn't get any thing

 

Thanks for the help!

Siva

 

Nice. Happy to hear that - you are most welcome Siva.

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