Hallo - I can't get PEDIT to work with two entities using the command subr. The process I go through at the command line is: PEDIT <sel arc1> <RETURN> "y" -- in response to question do I wish to turn into polyline "Join" <sel arc2> <RETURN> <RETURN> This is fine for joining the arcs, but I cannot seem to express it in code. I've tried: (command "PEDIT" ent1 "" "y" "Join" ent2 "" "") And other variations, but don't seem to get anywhere. Does anyone have any ideas why? Cheers, doug.
(setq ent1(entsel "\nSelect first object: ")) (setq ent2(entsel "\nSelect second object: ")) (command "PEDIT" ent1 "y" "j" ent1 ent2 "" "") (princ)
Doug, Under 2004 and previous 200x versions the command line prompts vary depending on whether the objects selected for joining include lines and/or arcs or only plines (heavy or light weight). I think this changed under 2005, but I'm not sure. Changed in the sense the question about convert line/arcs was eliminated. Maybe someone using 2005 will confirm, or say it ain't so. So a program which deals with whatever is selected (pre 2005) should look something like this given a selection set. (setq SS (ssget)) (if (ssget "P" '((0 . "ARC,LINE"))) ;test if previous SS contains arcs and/or lines (command "pedit" "M" SS "" "Y" "J" "J" "B" pause "") ;pause for fuzz (command "pedit" "M" SS "" "J" "J" "B" pause "") ) HTH Joe Burke
Hi Joe, Yes, in 2005 there is a system variable called PEDITACCEPT that will suppress the prompt, it says in help: Type: Integer Saved in: Registry Initial value: 0 Suppresses display of the Object Selected Is Not a Polyline prompt in PEDIT. The prompt is followed by "Do you want it to turn into one?" Entering y converts the selected object to a polyline. When the prompt is suppressed, the selected object is automatically converted to a polyline. 0 The prompt is displayed 1 The prompt is suppressed So starting from what you have and the objects are contiguous, and in a nutshell, this seems to work... (defun c:J ( / PdtAcc ss) (progn (setq PdtAcc (getvar "PEDITACCEPT")) (setvar "PEDITACCEPT" 1) (setq ss (ssget)) (if ss (progn (command "_.pedit" "M" ss "" "J" "" "") (setvar "PEDITACCEPT" PdtAcc) (princ "Attempting to join.") ) (princ "...Nope.") ) ) (princ) ) There are lots more to the PEDIT command that is not used here, such as a fuzz factor in the Join subroutine. Anyway, hope this helps biot023 some. Arnold Williams
Arnold, Thanks for the confirmation. Someday I'll get around to installing 2005. BTW, you wouldn't want make resetting the peditaccept var dependant on whether a selection set is found. Maybe something like this, or use an error handler to reset the var. (defun c:J ( / PdtAcc ss) (setq PdtAcc (getvar "PEDITACCEPT")) (setvar "PEDITACCEPT" 1) (if (setq ss (ssget)) (progn (command "_.pedit" "M" ss "" "J" "" "") (princ "Attempting to join.") ) (princ "...Nope.") ) (setvar "PEDITACCEPT" PdtAcc) (princ) ) Joe Burke
Joe, Yes, I do not consider myself a proficient programmer, just a designer with the need to customize. My coffee did not kick in yet when I did this stuff, noticed later a progn that was not necessary also. Will have to look more into this error handler business, some of my best stuff needs a good error workout - my best stuff is probably not that good - but still needs error handling. So thanks for that. Will also look at rearranging the variable after a selection is made. Good one, usually I have done it that way. I am sticking to my coffee story though. biot023... is this helping any? Arnold
This is all fantastic, cheers! I've got a rather old version of AutoCAD to work with, so I'm gonna have to have a play w/ the various suggestions here & let you all know how it goes. Once again, thanks for the fantastic response! doug.