AutoCAD 2022 killed lisp routine

AutoCAD 2022 killed lisp routine

JOHNLLOYD7213
Advocate Advocate
5,172 Views
29 Replies
Message 1 of 30

AutoCAD 2022 killed lisp routine

JOHNLLOYD7213
Advocate
Advocate

I just installed AutoCAD 2022 today & found a lisp routine that I've been using since the mid 90's has been broken. It's a revision cloud routine that works similarly to the freehand routine now built into AutoCAD. The main difference is that if the cloud is drawn anticlockwise it creates a "humpy" revision cloud, & if it is drawn clockwise it creates a "spikey" hold cloud. Basically, the routine still works, but the cloud is not displayed dynamically as it is created, but is only visible when finished. As the bulk of my work involves very busy P&IDs, revision clouds are often quite complex. I've played with the revcloud command built into AutoCAD, but I've found it inferior to the old routine that I've been using, & the "reverse" prompt does not appear if using the freehand option. I am not a lisp programmer so I have no idea what might need editing in the routine in order to resurrect it. Here is the routine pasted from a text editor. I hope some kind member here with god powers can bring it back to life for me.

 

;; CLOUD1.LSP
;;
;; TSC 6/10/93
;; Draws clouds
;; if type is "R" draw Rev. clouds (ie. arcs "outwards")
;; else draw Hold clouds (ie. arcs "inwards")
;; Hold clouds have (eg.) "HOLD #1" associated with them
;;
;; Doesn't matter if you start clockwise or anticlockwise
;; Maintains current ortho setting


(defun c:CLOUD1()
(command "LINETYPE" "s" "continuous" "")
(command "COLOR" "1")
; save current orthomode
(setq omode (getvar "orthomode"))
(setvar "orthomode" 0)
(setq pt1 (getpoint "\nFrom point: "))
(command "pline" pt1 "w" 0 0 "a")
(setq pt2 (getpoint pt1 "\nnext point: "))
; determine ang (+120 if anticlockwise, else -120)
; by testing x values of pt1 and pt2
; assumes type is rev. cloud
; check for hold cloud follows
(setq ang 120)
; convert ang to string
(setq ang (itoa ang))
(while (/= pt2 nil)
(command "a" ang pt2)
(setq pt2 (getpoint pt2 "\nnext point: "))
)
(command "a" ang pt1 "cl")

;reset orthomode
(setvar "orthomode" omode)
(princ)
)

0 Likes
5,173 Views
29 Replies
Replies (29)
Message 21 of 30

JOHNLLOYD7213
Advocate
Advocate

So is there any point me trying to get this routine re-written by someone who knows what they are doing, of has this functionality been killed off with the release of 2022?

0 Likes
Message 22 of 30

ronjonp
Mentor
Mentor

@JOHNLLOYD7213  There is a point to keep using a tool that works as expected and is productive. I'll take a look in the next few days and see what I can do. Have you looked at the built in alternatives to see if they fit the bill?

0 Likes
Message 23 of 30

JOHNLLOYD7213
Advocate
Advocate

Thanks for your reply ronjonp.

I have tried the built in routine, but it doesn't give me the control I need.

For example, I find the "manual" cloud snaps closed well before I want it to & if I want a "spikey" hold cloud, I need to see it created dynamically to ensure it doesn't overlap entities that I don't want it to. Inverting a cloud after creation is not suitable. If you manage to resurrect the routine at the start of this thread, I'd happily pay for your effort.

0 Likes
Message 24 of 30

dbroad
Mentor
Mentor

I can't help you with AutoCAD 2022 but I would report the problem as a bug.  I do like using the built-in revcloud feature but find that the lack of a reverse option to be a drawback when the cloud is sketched closed. Using the reverse command after the fact doesn't work.  There is no revcloud edit command.  If you use the freehand mode to sketch open revclouds, it retains the option to reverse. I use polygonal option mostly.

 

Here is a lisp that could be used to toggle the bulge in revclouds.

 

 

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 25 of 30

Kent1Cooper
Consultant
Consultant

How about this?  It draws Arcs one at a time, and PEDIT/Joins them together as it goes along, so that after each one, the completed [so far] joined Polyline is visible.  [But I haven't tried it in Acad2022 -- not up to that yet.]

 

(defun C:CLOUD2 (/ ltyp col omode osm peac pt0 pt1 pt2 cloud)
  (setq
    ltyp (getvar 'celtype)
    col (getvar 'cecolor)
    omode (getvar 'orthomode)
    osm (getvar 'osmode)
    peac (getvar 'peditaccept)
  ); setq
  (setvar 'celtype "continuous")
  (setvar 'cecolor "1")
  (setvar 'orthomode 0)
  (setvar 'osmode 0)
  (setvar 'peditaccept 1)
  (setq
    pt0 (getpoint "\nFrom point: ")
    pt1 pt0
  ); setq
  (while (setq pt2 (getpoint pt1 "\nnext point: "))
    (command "_.arc" pt1 "_e" pt2 "_angle" "120")
    (if cloud ; already started?
      (command "_.pedit" cloud "_join" (entlast) "" ""); then -- add last to it
      (progn ; else -- start it
        (command "_.pedit" (entlast) ""); convert to Polyline
        (setq cloud (entlast))
      ); progn
    ); if
    (setq pt1 pt2)
  ); while
  (command ; close back to beginning
    "_.arc" pt1 "_e" pt0 "_angle" "120"
    "_.pedit" cloud "_join" (entlast) "" ""
  ); command
;reset system variables
  (setvar 'orthomode omode)
  (setvar 'osmode osm)
  (setvar 'cecolor col)
  (setvar 'celtype ltyp)
  (setvar 'peditaccept peac)
  (princ)
); defun

 

I added some more System Variable controls, and you might want to also add a Layer setting [in which case you could omit setting the color and linetype].  One I added is to turn running Osnap off, but eliminate that if you sometimes Osnap to things to pick your points.  Another option to consider is whether to always close it back to the beginning [I built this that way because your CLOUD1 does that], or to have a choice to make an open one.

Kent Cooper, AIA
Message 26 of 30

JOHNLLOYD7213
Advocate
Advocate

Awesome!!!

Thank you so much Kent1Cooper.

You da man! 🙂

It works in 2022. I may be able to remove 2021 from my peecee after all.

I like to retain my existing running osnaps, & toggle them on & off via F3, & also toggle ortho mode via F8 during the command so I would like to remove the additional system variable controls. Because I don't talk the talk, I'm worried I'll break your code if I try fiddling with your routine. Could you please advise which lines to strip out to get back to the basic functionality of cloud1.lsp?

 

0 Likes
Message 27 of 30

Kent1Cooper
Consultant
Consultant

@JOHNLLOYD7213 wrote:

.... which lines to strip out to get back to the basic functionality of cloud1.lsp?


It hurts my heart to have you set an override linetype and color, and not set them back, but if that's really what you want:

(defun C:CLOUD2 (/ omode peac pt0 pt1 pt2 cloud)
  (setq
    omode (getvar 'orthomode)
    peac (getvar 'peditaccept)
  ); setq
  (setvar 'celtype "continuous")
  (setvar 'cecolor "1")
  (setvar 'orthomode 0)
  (setvar 'peditaccept 1)
  (setq
    pt0 (getpoint "\nFrom point: ")
    pt1 pt0
  ); setq
  (while (setq pt2 (getpoint pt1 "\nnext point: "))
    (command "_.arc" pt1 "_e" pt2 "_angle" "120")
    (if cloud ; already started?
      (command "_.pedit" cloud "_join" (entlast) "" ""); then -- add last to it
      (progn ; else -- start it
        (command "_.pedit" (entlast) ""); convert to Polyline
        (setq cloud (entlast))
      ); progn
    ); if
    (setq pt1 pt2)
  ); while
  (command ; close back to beginning
    "_.arc" pt1 "_e" pt0 "_angle" "120"
    "_.pedit" cloud "_join" (entlast) "" ""
  ); command
;reset system variables
  (setvar 'orthomode omode)
  (setvar 'peditaccept peac)
  (princ)
); defun

I kept the PEDITACCEPT one, because otherwise you could run into trouble with the conversion of the first Arc to a Polyline, depending on what that's set to [whether an answer to a conversion question needs to be supplied] -- a consideration not applicable to CLOUD1's approach.

Kent Cooper, AIA
0 Likes
Message 28 of 30

ronjonp
Mentor
Mentor

@JOHNLLOYD7213 Why don't you put your clouds on a common layer rather than setting byobject properties?

 

I personally automagically create a layer "Revision-YYYY-MO-DD for my changes.

0 Likes
Message 29 of 30

ВeekeeCZ
Consultant
Consultant

Anyone on 2022 for whom this works? 

 

(defun c:ang nil (strcat "<" (angtos (getangle "\nDirection:") (getvar 'aunits) 15)))

 

LINE

pick the first point

'ANG

you should pick two points now to determine a direction but the cursor freezes in 2022 so you have no visual. 

Thx.

0 Likes
Message 30 of 30

Christina_Strawther
Community Visitor
Community Visitor

Have there been any updates on this lisp since this was first brought up? I've just downloaded 2022 and am having the same issues and the commands that are readily available in CAD don't provide the same simplicity.

0 Likes