saunambon654 Posted February 24, 2023 Posted February 24, 2023 I have 1 Polyline with arc segments. I would like to select Polyline, then pick point P1 and P2 to create red Polyline. Is it possible? I have already seen the tool (name Extract Polyline Segment - https://www.urbanlisp.com/command/109/extract-polyline-segment/) but those are segment, not 2 points. Please my screenshot: https://prnt.sc/NKyWWVB4Gfvw Thank you. Quote
Steven P Posted February 24, 2023 Posted February 24, 2023 are you making a new polyline, so you have 2, or are you trimming the existing to the points, P1 and P2, to leave 1 polyline? If you make a copy the process will be the same after that to trim it to the points. I have something that might work, but for now a sample drawing to see what you are wanting might help 1 Quote
Isaac26a Posted February 24, 2023 Posted February 24, 2023 Maybe this one of lee mac can help you. 2 Quote
Steven P Posted February 24, 2023 Posted February 24, 2023 7 minutes ago, Isaac26a said: Maybe this one of lee mac can help you. You'll have to check this but comment out these ( use a ; at the beginning of the line) and it should create a line on top of the original ;; (vl-catch-all-apply 'vla-offset (list o d)) ;; (vl-catch-all-apply 'vla-offset (list o (- d))) ;; (vla-delete o) 2 Quote
saunambon654 Posted February 24, 2023 Author Posted February 24, 2023 @devitg: Please find the sample DWG file attached. @Steven P: Yes, I (step 1) created a polyline, (step 2) copied it from (list 0 0) to (list 0 0), (step 3) broke new polyline at P1 and P2, and in the end (step 4) erased polyline out side. @Isaac26a, Steven P: Yes, I already checked it. If the LISP from Lee-Mac allows zero distance is perfect. I also could do until step 3 by LISP, but step 4 I do not know how to determine it. Copying part of Polyline.dwg Quote
Steven P Posted February 25, 2023 Posted February 25, 2023 You'll also want to change this line: (setq d (getdist (strcat "\nSpecify Offset <" (rtos *off*) ">: "))) to (setq d 1) Quote
devitg Posted February 25, 2023 Posted February 25, 2023 @saunambon654 Please give it a try Please report any error strip-poly.LSP 2 Quote
saunambon654 Posted February 26, 2023 Author Posted February 26, 2023 10 hours ago, devitg said: @saunambon654 Please give it a try Please report any error strip-poly.LSP 2.13 kB · 3 downloads Thank devitg, If the direction P1->P2 is same with polyline, it works fine. But if not, it does nothing with error: Command: STR-POLY select the poly Select objects: Pick first pointPick the second point_break Select object: Specify second break point or [First point]: Command: Command: STR-POLY Unknown command "STR-POLY". Press F1 for help. Command: _break Select object: Specify second break point or [First point]: Command: Command: STR-POLY Unknown command "STR-POLY". Press F1 for help. Command: ; error: bad argument type: VLA-OBJECT nil Command: and one small thing: the BREAK command (VL-CMDF "_break" POLY-ENT P1 P1 "") should be (VL-CMDF "_break" POLY-ENT P1 P1). Quote
saunambon654 Posted February 26, 2023 Author Posted February 26, 2023 16 hours ago, Steven P said: You'll also want to change this line: (setq d (getdist (strcat "\nSpecify Offset <" (rtos *off*) ">: "))) to (setq d 1) I did not understand your idea. This is the result after (setq d 1). Could you explant some more detail? Quote
saunambon654 Posted February 26, 2023 Author Posted February 26, 2023 On 2/25/2023 at 12:01 AM, Isaac26a said: Maybe this one of lee mac can help you. Isaac26a, the calculation from Lee-Mac is too complicated for me, I could not understand it. But I have idea: Can I offset a polyline with distance 1, and do it again back with distance -1? Quote
saunambon654 Posted February 26, 2023 Author Posted February 26, 2023 Thank you Steven P for your idea. I have improved the lisp from Lee-Mac. It also works for LWPolyline inside block with alternative NEnsel. Please take a look. Copying part of Polyline2.dwg PLP - Copying part of LWPolyline.lsp 1 Quote
saunambon654 Posted February 27, 2023 Author Posted February 27, 2023 Hi guys, Please help to improve that LISP to supports 2DPolyline and SPLine as well. It will become great! Thank you. Quote
XDSoft Posted April 3 Posted April 3 On 2/24/2023 at 10:35 PM, saunambon654 said: I have 1 Polyline with arc segments. I would like to select Polyline, then pick point P1 and P2 to create red Polyline. Is it possible? I have already seen the tool (name Extract Polyline Segment - https://www.urbanlisp.com/command/109/extract-polyline-segment/) but those are segment, not 2 points. Please my screenshot: https://prnt.sc/NKyWWVB4Gfvw Thank you. On 2/24/2023 at 10:35 PM, saunambon654 said: I have 1 Polyline with arc segments. I would like to select Polyline, then pick point P1 and P2 to create red Polyline. Is it possible? I have already seen the tool (name Extract Polyline Segment - https://www.urbanlisp.com/command/109/extract-polyline-segment/) but those are segment, not 2 points. Please my screenshot: https://prnt.sc/NKyWWVB4Gfvw Thank you. https://www.theswamp.org/index.php?topic=59415.0 1 Quote
XDSoft Posted April 12 Posted April 12 [XDrX-PlugIn(122)] Coping part of Polyline (theswamp.org) https://www.theswamp.org/index.php?topic=59415.0 (defun c:xdtb_plcpypart (/ wid e e1 p1 p2 p3) (xdrx-begin) (xdrx-sysvar-push '("osmode" 544)) (if (and (setq wid (getreal (xdrx-string-multilanguage "\n多段线宽度<退出>:" "\nPolyline Width<exit>:"))) (setq e (car (xdrx-entsel (xdrx-string-multilanguage "\n拾取多段线<退出>:" "\nPick Polyline<Exit>" ) '((0 . "*polyline")) ) ) ) (setq p1 (getpoint (xdrx-string-multilanguage "\n起始点<退出>:" "\nStart Point<Exit>:" ) ) ) (cond ((xdrx-curve-isclosed e) (setq p2 (getpoint (xdrx-string-multilanguage "\n中间点<退出>:" "\nThe Middle Point<Exit>:" ) ) ) ) (t t ) ) (setq p3 (getpoint (xdrx-string-multilanguage "\n结束点<退出>:" "\nThe End Point<Exit>:" ) ) ) ) (progn (and (setq e1 (xdrx-curve-setinterval e p1 p3 p2)) (xdrx-entity-make e1) (xdrx-setpropertyvalue (entlast) "constantwidth" wid "color" 1)) ) ) (xdrx-sysvar-pop) (xdrx-end) (princ) ) Quote
Recommended Posts
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.