Jump to content

extend polyline up to specific distance by selecting specific block


rpsalvi

Recommended Posts

This seems to work but only for the scenario provided, needs a extra check for direction is left/right. Will need some more work, think of it as proof of concept.

 

When asked to pick a line, pick near end to move.

; https://www.cadtutor.net/forum/topic/89269-extend-polyline-up-to-specific-distance-by-selecting-specific-block/
; By AlanH Aug 2024

(if (not AH:getvalsm)(load "Multi Getvals.lsp"))
(setq ans (AH:getvalsm (list "Enter values " "Hor offset " 5 4 "500" "Ver offset " 5 4 "1200" )))
(setq h (atof ( car ans)) v (atof (cadr ans)))

(setq obj1 (vlax-ename->vla-object (car (entsel "\nSelect a block "))))
(setq pt (vlax-get obj1 'insertionpoint))
(setq ptx (car pt) pty (cadr pt))

(setq ent (entsel "\nSelect Horizontal line "))
(setq obj2 (vlax-ename->vla-object (car ent)))
(setq start (vlax-curve-getstartPoint obj2))
(setq end (vlax-curve-getEndPoint obj2))
(setq pt3 (cadr ent))

(setq d1 (distance pt3 end))
(setq d2 (distance pt3 start))
(if (< d1 d2)
(setq swap "yes")
)

(setq pt2 (list (+ h ptx) (cadr end)))
(if (= swap "yes")
(vlax-put obj2 'endpoint pt2)
(vlax-put obj2 'startpoint pt2)
)

(setq ent (entsel "\nSelect Vertical line "))
(setq obj2 (vlax-ename->vla-object (car ent)))
(setq start (vlax-curve-getstartPoint obj2))
(setq end (vlax-curve-getEndPoint obj2))

(setq pt3 (cadr ent))
(setq d1 (distance pt3 end))
(setq d2 (distance pt3 start))
(if (< d1 d2)
(setq swap "yes")
)

(setq pt2 (list (car end)(- pty v)))
(if (= swap "yes")
(vlax-put obj2 'endpoint pt2)
(vlax-put obj2 'startpoint pt2)
)

 

Added to my to do list to take into account directions.

Multi GETVALS.lsp

Link to comment
Share on other sites

actually this circle is pile and i want to extend poly line 500 mm on right and left side of pile & 2750 mm in bottom side of pile 

Link to comment
Share on other sites

I did what you showed in image, not sure about "500 mm on right and left side of pile" please post another image or dwg, zoom in a bit please for image.

Link to comment
Share on other sites

Again I did what you showed in image

 

Just save multi getvals in support path or add full path to (Load "Multi getvals")

 

image.png.4ed9b5d80a6021813e8c7a0a56c0062e.png

Link to comment
Share on other sites

On 8/14/2024 at 2:55 PM, BIGAL said:

multi getvals

CAN U HELP ME TO LOAD THIS LISP FILE?

Link to comment
Share on other sites

3 hours ago, rpsalvi said:

CAN U HELP ME TO LOAD THIS LISP FILE?

can you stop typing with "capslock" ?
for some countries typing with "capslock" means shouting. I don't think it's ethical to ask for help by screaming

Link to comment
Share on other sites

Copy and paste the code above into notepad, than save as a lisp file, ie .lsp.

 

The multi getvals is demand loaded so it must be in a location that can be found, easiest way is edit this line in the code. Put in where you have saved the file make sure to use "\\" like example it can be a single or multiple directories deep. 

 

(if (not AH:getvalsm)(load "C:\\mydirectory\\where i saved\\Multi Getvals.lsp"))

 

  • Like 1
Link to comment
Share on other sites

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