Jump to content

Coping part of Polyline


saunambon654

Recommended Posts

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.

Copying part of Polyline.png

Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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)

 

  • Like 2
Link to comment
Share on other sites

@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

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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?

image.png.70375a039e2157422b608f9069bbb8b3.png

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 1 year later...
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.

Copying part of Polyline.png

 

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.

Copying part of Polyline.png

 

https://www.theswamp.org/index.php?topic=59415.0

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

 

Video_2024-04-12_165717.gif.9106cb9f52cf91f7c8f42ea60c973437.gif

 

[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)
)

 

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