Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Silent Pedit

51 REPLIES 51
Reply
Message 1 of 52
hmsilva
4507 Views, 51 Replies

Silent Pedit

I'm trying to execute a pedit command in a lisp routine, without echoing, with no luck...

cmdecho and nomutt dont resolve my problem...

Can somebody points me the right way please...

Any help would be most appreciated.

Cheers

Henrique

EESignature

51 REPLIES 51
Message 2 of 52
kingkusa
in reply to: hmsilva

Mr. Silva

First of all you have to get an idea of how Pedit command works.
Message 3 of 52
Anonymous
in reply to: hmsilva

which version of acad do you use?
(command "_pedit" w "_f" "")
is a silent command in acad 2004
where (setq w (car (entsel "your polyline")))
CMDECHO 0
EXPERT 1
dont forget the (princ) at the end of the
(defun
..
..
..
(princ)
)

hmsilva wrote:
> I'm trying to execute a pedit command in a lisp routine, without echoing, with no luck...
>
> cmdecho and nomutt dont resolve my problem...
>
> Can somebody points me the right way please...
>
> Any help would be most appreciated.
>
> Cheers
>
> Henrique
Message 4 of 52
hmsilva
in reply to: hmsilva

Hi gert

thanks for your reply, I use A2K8 and I am doing lots of pedit's
inside my code, and each time I do one I get's the echo message ...

I have the CMDECHO set to 0, and EXPERT to zero too.

I'll try to set to 1.

Thanks again

Henrique

EESignature

Message 5 of 52
hmsilva
in reply to: hmsilva

CMDECHO 0
EXPERT 1

no luck...

Thanks anyway…

Henrique

EESignature

Message 6 of 52
Anonymous
in reply to: hmsilva

make a screenshot of the message you get and post it

hmsilva wrote:
> Hi gert
>
> thanks for your reply, I use A2K8 and I am doing lots of pedit's
> inside my code, and each time I do one I get's the echo message ...
>
> I have the CMDECHO set to 0, and EXPERT to zero too.
>
> I'll try to set to 1.
>
> Thanks again
>
> Henrique
Message 7 of 52
hmsilva
in reply to: hmsilva

Hi gert

It's done..

Setting NOMUTT to 1

Thanks again...

Cheers

Henrique

EESignature

Message 8 of 52
Anonymous
in reply to: hmsilva

Hi hmsilva,
How about my code maybe can help you
[code]
; arp is stand for As Replace Pedit
; Design by : Adesu
; Email : mteybid@yuasabattery.co.id
; Homepage : http://www.yuasa-battery.co.id
; Create : 08 June 2007
; Program no.: 0592/06/2007
; Edit by :
; Idea from : VVA

(defun c:arp (/ ss)
(prompt "\nSelect alls object line")
(while
(not ss)
(setq ss (ssget))
) ; while
(if
ss
(progn
(if
(and (getvar "peditaccept")(= (getvar "peditaccept") 1))
(command "_pedit" "_m" ss "" "_j" 0 "")
(command "_pedit" "_m" ss "" "_y" "_j" 0 ""))
) ; progn
) ; if
(princ)
) ; defun
[/code]

wrote in message news:5694569@discussion.autodesk.com...
I'm trying to execute a pedit command in a lisp routine, without echoing,
with no luck...

cmdecho and nomutt dont resolve my problem...

Can somebody points me the right way please...

Any help would be most appreciated.

Cheers

Henrique
Message 9 of 52
hmsilva
in reply to: hmsilva

Hi Adesu

Thanks for your reply, my code is done..

My problem was just removing the echo from the command line and I solve it seting the NOMUTT sysvar to 1.

My code is an automatic Pedit, by selecting one; line, arc or poly, it scans the endpoints and perform a pedit until there is no more elements to join...

Thanks again

Henrique

EESignature

Message 10 of 52
Ktelang
in reply to: hmsilva

Hello Mr Silva,

 

Can you please share the code.

I will be performing similar 1000s  of 

pedits. I think your last post talks about exactly what

I want.

 

If I am not asking too much and if its fine with 

you I will appreciate your help related to same

 

Thanks

 

 

 

 

------------------------------------------------------------------------------
Config :: Intel (R) Xeon (R) CPU E31245 @ 3.30 GHz, 16.0 GB, 64bit win7
Inventor 2013 and Vault Basic 2013
-----------------------------------------------------------------------------
Message 11 of 52
Kent1Cooper
in reply to: hmsilva


hmsilva wrote:
....

My code is an automatic Pedit, by selecting one; line, arc or poly, it scans the endpoints and perform a pedit until there is no more elements to join...
....


That description sounds like a lot more work than necessary.  Just do this:

 

(defun C:PEJA (/ peac cmde); = Polyline Edit: Join All
  (setq peac (getvar 'peditaccept))
  (setvar 'peditaccept 1)
  (setq cmde (getvar 'cmdecho))
  (setvar 'cmdecho 0)
  (command "_.pedit" pause "_join" "_all" "" "")
  (setvar 'peditaccept peac)
  (setvar 'cmdecho cmde)
  (princ)
)
 

Yes, in the object selection it will find everything in the current space, but it will ignore anything that doesn't connect end-to-end with the selected object, and anything of the wrong object type, and join everything it can.  No scanning of endpoints is needed.

 

For me back in AutoCAD 2004, setting CMDECHO to 0 does suppress echoing to the Command: line [otherwise I wouldn't have included it here], so the problem in the original post doesn't exist.  But even if that's changed in newer versions, the Join All approach means there isn't very much echoed there, anyway [certainly nothing like what would be in the approach quoted above], no matter how many things are joined.

 

It could be made more sophisticated, such as by restricting object selection to only Peditable types, if desired.

Kent Cooper, AIA
Message 12 of 52
TomBeauford
in reply to: Kent1Cooper

Simular, but if you select more than one line this one will just join the selected segments:

(defun c:pljoin (/ cmdecho peditaccept ss ss1 lent)
  (setq cmdecho (getvar "cmdecho")
        peditaccept (getvar "peditaccept")
        lent (entlast)
  )
  (setvar "cmdecho" 0)
  (setvar "peditaccept" 1)
  (princ "\nSelect object to join: ")
  (setq ss (ssget '((0 . "LINE,ARC,POLYLINE,LWPOLYLINE"))))
  (if (/= ss nil)
      (progn
	(if (= (sslength ss) 1)
          (progn
            (sssetfirst nil ss)
            (command "_.pedit" "_J" (ssget "X" '((0 . "LINE,ARC,POLYLINE,LWPOLYLINE"))) "" "")
          )
          (command "_.pedit" "_M" ss "" "_J" "0.0" "")
	)
      )
  )
  (setvar "cmdecho" cmdecho)
  (setvar "peditaccept" peditaccept)
  (princ)
)

 I have it in my Edit Shortcut menu.  I used to use the Macro: ^C^C^P(ssget);pedit;m;p;;j;0.0;;

I wrote the code because I'll often join a few lines and didn't want to have any extra joined in.

 

64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter
Message 13 of 52
Ktelang
in reply to: TomBeauford

Thanks for that perfect
------------------------------------------------------------------------------
Config :: Intel (R) Xeon (R) CPU E31245 @ 3.30 GHz, 16.0 GB, 64bit win7
Inventor 2013 and Vault Basic 2013
-----------------------------------------------------------------------------
Message 14 of 52
greg_battin
in reply to: Kent1Cooper

Hey Kent,

this routine (EJA) is awesome. I use it almost everyday.

Thank you

~Greg

Message 15 of 52
ojuris
in reply to: TomBeauford

This one  (ljoin) from beaufordt  is perfect!

 

THANKS

 

 

Juris

Message 16 of 52
Kent1Cooper
in reply to: TomBeauford


@TomBeauford wrote:

....

(defun c:pljoin (/ cmdecho peditaccept ss ss1 lent)
  (setq cmdecho (getvar "cmdecho")
        peditaccept (getvar "peditaccept")
        lent (entlast)
  )
  (setvar "cmdecho" 0)
  (setvar "peditaccept" 1)
  (princ "\nSelect object to join: ")
  (setq ss (ssget '((0 . "LINE,ARC,POLYLINE,LWPOLYLINE"))))
  (if (/= ss nil)
      (progn
	(if (= (sslength ss) 1)
          (progn
            (sssetfirst nil ss)
            (command "_.pedit" "_J" (ssget "X" '((0 . "LINE,ARC,POLYLINE,LWPOLYLINE"))) "" "")
          )
          (command "_.pedit" "_M" ss "" "_J" "0.0" "")
	)
      )
  )
  (setvar "cmdecho" cmdecho)
  (setvar "peditaccept" peditaccept)
  (princ)
)

.... 


I like the automatic handling of multiple joins if multiple things are selected, but join-everything-possible if only one is.  For my own use, I made a streamlined version [removed unused lent variable and took unused ss1 out of local variables list, removed two unnecessary (progn)'s & an (sssetfirst), simplified (ssget) filtering and join-all-possible object selection, made prompt more descriptive, shortened command name and some variable names, consolidated (setq)'s, repositioned (setvar)'s to eliminate need for error handling to reset if cancelled in selection].

 

;; PolylineJoin.lsp [command name: PJ]
;; Based on c:pljoin by beaufordt from AutoCAD Customization Discussion Group
;; Streamlined by Kent Cooper, June 2011
(defun C:PJ (/ cmde peac ss); = Polyline Join
  (princ "\nTo join touching objects into Polyline(s) [pick 1 to join all possible objects to it],")
  (setq
    ss (ssget '((0 . "LINE,ARC,*POLYLINE")))
    cmde (getvar 'cmdecho)
    peac (getvar 'peditaccept)
  ); end setq
  (setvar 'cmdecho 0)
  (setvar 'peditaccept 1)
  (if ss
    (if (= (sslength ss) 1)
      (command "_.pedit" ss "_join" "_all" "" ""); then
      (command "_.pedit" "_multiple" ss "" "_join" "0.0" ""); else
    ); end inner if
  ); end outer if
  (setvar 'cmdecho cmde)
  (setvar 'peditaccept peac)
  (princ)
); end defun

Kent Cooper, AIA
Message 17 of 52
Kent1Cooper
in reply to: Kent1Cooper

An update of the PolylineJoin.lsp routine [PJ command], with added error handling, rejection of selection 3D Polylines [which can't be joined] and 2D "heavy" Polylines that are spline- or fit-curved [because joining them to other things removes their curvature], preservation of selected Lines/Arcs that don't have contiguous objects to join to as Lines/Arcs rather than single-segment Polylines, and a few other small refinements.

 

Also posted on this later thread:

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Lines-to-pline-in-one-step/m-p/353442...

where the same subject came up again.

Kent Cooper, AIA
Message 18 of 52
danielrT8PHL
in reply to: Kent1Cooper

The polylinejoin.lsp doesn't seem to work on ACAD2002. This is the error message I receive:

 

Error: AutoCAD variable setting rejected: PEDITACCEPT 1; error: An error has
occurred inside the *error* functionAutoCAD variable setting rejected:
PEDITACCEPT nil

 

I know I'm using an ancient release of ACAD, but is there a way to make this work??

Message 19 of 52
Kent1Cooper
in reply to: danielrT8PHL


@danielrT8PHL wrote:

The polylinejoin.lsp doesn't seem to work on ACAD2002. ….


 

Does the PEDITACCEPT variable exist at all in 2002?  If not, does it work as if in later versions it was set to 1?  That is, in PEDIT, if you select a Line or Arc that isn't already a Polyline, does it just go ahead without challenging you?  If that's the case, the routine could be "fixed" to remove all references to it, i.e. remove these lines:

 

  (setvar 'peditaccept peac) ;; in two places

 

    peac (getvar 'peditaccept)

 

  (setvar 'peditaccept 1)

 

and take 'peac' out of the localized variables list at the top.

Kent Cooper, AIA
Message 20 of 52
john.uhden
in reply to: hmsilva

What do you want to do?

Maybe my VEDIT routine would be helpful.

John F. Uhden

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost