Select object between two points and join them

Select object between two points and join them

arunkumar_selvarajan
Participant Participant
3,037 Views
33 Replies
Message 1 of 34

Select object between two points and join them

arunkumar_selvarajan
Participant
Participant

I required a LSIP program to select between first point and second point and then it should be joined.

below code i tried, but not working

 

(defun c:JoinCurvesBetweenPoints ( / pt1 pt2 ss i ent objList)
;; Prompt for the first point
(setq pt1 (getpoint "\nSpecify first point: "))
;; Prompt for the second point
(setq pt2 (getpoint "\nSpecify second point: "))

;; Select objects between the two points
(setq ss (ssget "C" pt1 pt2))

;; Check if any objects were selected
(command "_.pedit" ss "J" "y" "J")
(princ)
)

 

0 Likes
Accepted solutions (1)
3,038 Views
33 Replies
Replies (33)
Message 21 of 34

Kent1Cooper
Consultant
Consultant

From line 82, and the same construction at line 100:

(command "pedit" pt2 "" "j" "c" pt1 (list (car pt11)(cadr pt7)) "" "")

That "" [Enter] after pt2 is probably the error -- Enter is not a valid entry at that point, whether pt2 is on an object or not.

Kent Cooper, AIA
0 Likes
Message 22 of 34

paullimapa
Mentor
Mentor

My analysis exactly back message 12


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 23 of 34

Kent1Cooper
Consultant
Consultant

Another little thing I noticed....  Shouldn't this line:

  di_typ Pressure) ; Define the height of the shell

be this instead?

  di_typ "Pressure") ; Define the height of the shell

Kent Cooper, AIA
Message 24 of 34

paullimapa
Mentor
Mentor

@arunkumar_selvarajan after @Kent1Cooper correction I'd get this message which means it never runs the key part of the code:

paullimapa_0-1722272635412.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 25 of 34

john.uhden
Mentor
Mentor

@Kent1Cooper ,

That's just like my own QJOIN command that selects all joinable curve objects having the same layer, and elevation, and not closed.  Being old it uses the PEDIT command, not the JOIN command.

John F. Uhden

0 Likes
Message 26 of 34

Kent1Cooper
Consultant
Consultant

@john.uhden wrote:

That's just like my own QJOIN command that selects all joinable curve objects ....


I assume "That" refers to Message 19 [always best to quote at least something of what you're Replying to].

 

I have a command that does what is described there -- the PJ command in PolylineJoin.lsp, >here<.  If you pick one thing, it connects everything to it that it can.  If you pick multiple things, it connects all of them that it can into however many resulting Polylines they come to.  It also uses PEDIT, not JOIN [which didn't exist when it was first written].  See comments at the top.

Kent Cooper, AIA
Message 27 of 34

john.uhden
Mentor
Mentor

@Kent1Cooper ,

Are you old enough to remember Professor Irwin Corey?

Q:  What is that?

Corey:  "That" is a prepositional nominative...

John F. Uhden

0 Likes
Message 28 of 34

john.uhden
Mentor
Mentor

@Kent1Cooper ,

I have my own PJOIN command also.

I like it because:

  1. It keeps showing the cold grips with every segment added.
  2. It warns you of differences in elevation allowing you change the next target.
  3. It has a tolerance setting to adjust endpoints if they don't exactly match or to fill in a gap.

John F. Uhden

0 Likes
Message 29 of 34

arunkumar_selvarajan
Participant
Participant

Hi @Kent1Cooper,

 

this program is to only create the dish part in drawing, so there will be many 2d sketch present in the drawing model space, it should not affect the others, Thats why im keen to select only between two points.

 

 

0 Likes
Message 30 of 34

arunkumar_selvarajan
Participant
Participant

Hi @paullimapa & @Kent1Cooper 
 Please find the attached updated code, this will work until that selection and offset. 

please check and let me know.

0 Likes
Message 31 of 34

paullimapa
Mentor
Mentor

now when the PR-DISH starts it's prompting for Base point of dish

where should this be?

paullimapa_0-1722629794493.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 32 of 34

paullimapa
Mentor
Mentor
Accepted solution

Ok, I got it to work. I just selected 0,0 as the base point of the dish (which can be actually anywhere on the screen).

Then I had to change in the section of the PEDIT line of your code:

1) I have to first do a ZOOM Extent so that the LINE selected with pt13 can be recognized by the PEDIT command

2) Then I changed the coordinate from pt18 to pt19 to successfully get a crossing selection 

So change this:

 

(command "pedit" pt13 ""  "j" "c" pt18 pt32 "" "")

 

To these lines:

 

  (command "_.Zoom" "_E")
  (command "_.Pedit" pt13 ""  "_J" "_C" pt19 pt32 "" "")

 

Then it works and ends requesting for rotation:

paullimapa_0-1722635382887.png

FYI, the code also fails if you don't have those Layers "1" and "7" already created since your code only Sets to them but does not check to see if they exists first...

You may want to use the Layer Make option which will create the Layer if it doesn't exists and then automatically Sets that as the current Layer.

So replace these lines:

 

(command "-layer" "s" "1" "")
(command "-layer" "s" "7" "")

 

With these lines:

 

(command "-layer" "_M" "1" "")
(command "-layer" "_M" "7" "")

 

Lastly, when PEDITACCEPT is set to 1 instead of 0 this causes error messages to fly across the command line.

But the PR-DISH command will still complete successfully.

 

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 33 of 34

arunkumar_selvarajan
Participant
Participant
Thanks Paul Li for the update, it works perfect and as expected.
0 Likes
Message 34 of 34

paullimapa
Mentor
Mentor

glad to have helped...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos