Author Topic: Help on my Rectangular RevCloud  (Read 6883 times)

0 Members and 1 Guest are viewing this topic.

RolandOrzabal

  • Newt
  • Posts: 86
  • "memories fade but the scars still linger"
Help on my Rectangular RevCloud
« on: September 19, 2012, 05:37:03 AM »
Hi can you guys help me with this routine? it looks like "reinventing the wheel" but this one make a rectangular revision cloud by first asking the user for arc distances, then for the Revision cloud style. Then the user picks 2 points and there goes the revision cloud. Then reason is that we use this either in paper/model space

My problem is that i want the value of distance 1 to show while inputing distance 2. While Dis1 value is shown, the user can either press enter or input another value provided that the value should be equal or greater than Dis1

this code forces the user to enter a value for Dis2, not accepting the shown value of Dis1

and after the routine is done and i want to repeat all, how can the code remember the Dis1 and Dis2 values so the user doesn't need to enter the values again?

Code: [Select]
(defun c:try (/ Dis1 Dis2 pt1 pt2 obj )
(setq old_osm (getvar "OSMODE"))
 (setvar "osmode" 0)
 (setvar 'cmdecho 0)
 (setq PLW (getvar "plinewid"))
 (setvar "plinewid" 0)
 (initget (+ 1 2 4))
 (while (= Dis1 nil)
(setq Dis1 (getreal "\nMin Arc Distance: "))
 )
 (while (= Dis2 nil)
(setq Dis2 (getreal (strcat"\nMax Arc Distance: <" (rtos Dis1) ">  ")))
 )
  (setq cont T)
    (while cont
        (setq cont nil)
        (initget "Normal / Calligraphic")
        (setq kw (getkword "\nRevcloud Style \nSelect option [ Normal / Calligraphic ] <Normal>:"))
(if (not kw) (setq kw "Normal"))
        (cond
            ((= kw "Normal") (C:RV_Normal))
            ((= kw "Calligraphic") (C:RV_Calligraphic))
)
)
(setq Dis1 nil)
(setq Dis2 nil)
(setvar "plinewid" PLW)
(setvar "cmdecho" cmd1)
)

(defun c:RV_Normal ()
(setq pt1 (getpoint "\nFirst corner of revison cloud: "))
(setq pt2 (getcorner "\nDiagonal corner of revision cloud " pt1))
(command "._RECTANG" pt1 pt2)
(setq obj (entlast))
(command "._revcloud" "style" "n" "ARC" Dis1 Dis2 "OBJECT" obj "" )
)

(defun c:RV_Calligraphic ()
(setq pt1 (getpoint "\nFirst corner of revison cloud: "))
(setq pt2 (getcorner "\nDiagonal corner of revision cloud " pt1))
(command "._RECTANG" pt1 pt2)
(setq obj (entlast))
(command "._revcloud" "style" "C" "ARC" Dis1 Dis2 "OBJECT" obj "")
)

(princ)
"memories fade but the scars still linger"

ribarm

  • Gator
  • Posts: 3287
  • Marko Ribar, architect
Re: Help on my Rectangular RevCloud
« Reply #1 on: September 19, 2012, 07:14:00 AM »
Replace lines from (initget ...) (while ...) (while ...) with this :

Code: [Select]
(initget (+ 2 4))
 (while (= Dis1 nil)
    (setq Dis1 (getreal (if a (strcat "\nMin Arc Distance <" (rtos a) "> : ") "\nMin Arc Distance :")))
    (if (null Dis1) (setq Dis1 a))
 )
 (while (= Dis2 nil)
    (setq Dis2 (getreal (if b (strcat "\nMax Arc Distance - must be greater than " (rtos Dis1) " <" (rtos b) "> : ") (strcat "\nMax Arc Distance - must be greater than " (rtos Dis1) " : "))))
    (if (null Dis2) (setq Dis2 b))
 )
 (setq a Dis1 b Dis2)
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

RolandOrzabal

  • Newt
  • Posts: 86
  • "memories fade but the scars still linger"
Re: Help on my Rectangular RevCloud
« Reply #2 on: September 19, 2012, 07:24:05 AM »
Replace lines from (initget ...) (while ...) (while ...) with this :

Code: [Select]
(initget (+ 2 4))
 (while (= Dis1 nil)
    (setq Dis1 (getreal (if a (strcat "\nMin Arc Distance <" (rtos a) "> : ") "\nMin Arc Distance :")))
    (if (null Dis1) (setq Dis1 a))
 )
 (while (= Dis2 nil)
    (setq Dis2 (getreal (if b (strcat "\nMax Arc Distance - must be greater than " (rtos Dis1) " <" (rtos b) "> : ") (strcat "\nMax Arc Distance - must be greater than " (rtos Dis1) " : "))))
    (if (null Dis2) (setq Dis2 b))
 )
 (setq a Dis1 b Dis2)

thanks MR! that worked! am going to use this also to make a polygonal revcloud.
cheers MR! thanks again!
"memories fade but the scars still linger"

RolandOrzabal

  • Newt
  • Posts: 86
  • "memories fade but the scars still linger"
Re: Help on my Rectangular RevCloud
« Reply #3 on: September 19, 2012, 08:16:52 PM »
M.R. tried the code again and found some "bug"

Dis2 should be equal or greater than Dis1. after entering Dis1 say 300 and Dis2 say 50, the routine continues to run.
i think it should pause until the user inputs a value equal or greater that Dis1

Thanks in advance
"memories fade but the scars still linger"

ribarm

  • Gator
  • Posts: 3287
  • Marko Ribar, architect
Re: Help on my Rectangular RevCloud
« Reply #4 on: September 19, 2012, 11:49:13 PM »
Try this :

Code: [Select]
(defun c:RV ( / Dis1 Dis2 old_osm cmd1 PLW )
 (setq old_osm (getvar "OSMODE"))
 (setq cmd1 (getvar "CMDECHO"))
 (setq PLW (getvar "plinewid"))
 (setvar "osmode" 0)
 (setvar "cmdecho" 0)
 (setvar "plinewid" 0)
 (initget (+ 2 4))
 (while (= Dis1 nil)
  (setq Dis1 (getreal (if a (strcat "\nMin Arc Distance <" (rtos a) "> : ") "\nMin Arc Distance :")))
  (if (null Dis1) (setq Dis1 a))
 )
 (while (= Dis2 nil)
  (setq Dis2 (getreal (if b (strcat "\nMax Arc Distance - must be greater than " (rtos Dis1) " <" (rtos b) "> : ") (strcat "\nMax Arc Distance - must be greater than " (rtos Dis1) " : "))))
  (if (null Dis2) (setq Dis2 b))
  (if (< Dis2 Dis1) (setq Dis2 nil))
 )
 (setq a Dis1 b Dis2)
 (initget "Normal Calligraphic")
 (setq kw (getkword "\nRevcloud Style \nSelect option [ Normal / Calligraphic ] <Normal>:"))
 (if (not kw) (setq kw "Normal"))
 (cond
  ((= kw "Normal") (C:RV_Normal))
  ((= kw "Calligraphic") (C:RV_Calligraphic))
 )
 (setvar "plinewid" PLW)
 (setvar "cmdecho" cmd1)
 (setvar "osmode" old_osm)
 (princ)
)

(defun c:RV_Normal ( / pt1 pt2 obj )
 (setq pt1 (getpoint "\nFirst corner of revison cloud : "))
 (setq pt2 (getcorner "\nDiagonal corner of revision cloud " pt1))
 (command "._RECTANG" pt1 pt2)
 (setq obj (entlast))
 (command "._revcloud" "style" "n" "ARC" Dis1 Dis2 "OBJECT" obj "" )
 (princ)
)

(defun c:RV_Calligraphic ( / pt1 pt2 obj )
 (setq pt1 (getpoint "\nFirst corner of revison cloud : "))
 (setq pt2 (getcorner "\nDiagonal corner of revision cloud " pt1))
 (command "._RECTANG" pt1 pt2)
 (setq obj (entlast))
 (command "._revcloud" "style" "C" "ARC" Dis1 Dis2 "OBJECT" obj "")
 (princ)
)

M.R.
« Last Edit: September 20, 2012, 12:14:54 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

RolandOrzabal

  • Newt
  • Posts: 86
  • "memories fade but the scars still linger"
Re: Help on my Rectangular RevCloud
« Reply #5 on: September 20, 2012, 01:55:55 AM »
Try this :

Code: [Select]
(defun c:RV ( / Dis1 Dis2 old_osm cmd1 PLW )
 (setq old_osm (getvar "OSMODE"))
 (setq cmd1 (getvar "CMDECHO"))
 (setq PLW (getvar "plinewid"))
 (setvar "osmode" 0)
 (setvar "cmdecho" 0)
 (setvar "plinewid" 0)
 (initget (+ 2 4))
 (while (= Dis1 nil)
  (setq Dis1 (getreal (if a (strcat "\nMin Arc Distance <" (rtos a) "> : ") "\nMin Arc Distance :")))
  (if (null Dis1) (setq Dis1 a))
 )
 (while (= Dis2 nil)
  (setq Dis2 (getreal (if b (strcat "\nMax Arc Distance - must be greater than " (rtos Dis1) " <" (rtos b) "> : ") (strcat "\nMax Arc Distance - must be greater than " (rtos Dis1) " : "))))
  (if (null Dis2) (setq Dis2 b))
  (if (< Dis2 Dis1) (setq Dis2 nil))
 )
 (setq a Dis1 b Dis2)
 (initget "Normal Calligraphic")
 (setq kw (getkword "\nRevcloud Style \nSelect option [ Normal / Calligraphic ] <Normal>:"))
 (if (not kw) (setq kw "Normal"))
 (cond
  ((= kw "Normal") (C:RV_Normal))
  ((= kw "Calligraphic") (C:RV_Calligraphic))
 )
 (setvar "plinewid" PLW)
 (setvar "cmdecho" cmd1)
 (setvar "osmode" old_osm)
 (princ)
)

(defun c:RV_Normal ( / pt1 pt2 obj )
 (setq pt1 (getpoint "\nFirst corner of revison cloud : "))
 (setq pt2 (getcorner "\nDiagonal corner of revision cloud " pt1))
 (command "._RECTANG" pt1 pt2)
 (setq obj (entlast))
 (command "._revcloud" "style" "n" "ARC" Dis1 Dis2 "OBJECT" obj "" )
 (princ)
)

(defun c:RV_Calligraphic ( / pt1 pt2 obj )
 (setq pt1 (getpoint "\nFirst corner of revison cloud : "))
 (setq pt2 (getcorner "\nDiagonal corner of revision cloud " pt1))
 (command "._RECTANG" pt1 pt2)
 (setq obj (entlast))
 (command "._revcloud" "style" "C" "ARC" Dis1 Dis2 "OBJECT" obj "")
 (princ)
)

M.R.


Great Marko! Thanks a lot! just how i wanted it to be!
cheers!
"memories fade but the scars still linger"

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Help on my Rectangular RevCloud
« Reply #6 on: September 20, 2012, 09:27:37 AM »
Another option: dynamic block - see attached dwg

Now I use a custom lisp that checks to see if the block exists, if not, imports it from a "standards" drawing then puts it on the A-Anno-Revs layer.  But maybe the dblock can get you started.

jb
James Buzbee
Windows 8

RolandOrzabal

  • Newt
  • Posts: 86
  • "memories fade but the scars still linger"
Re: Help on my Rectangular RevCloud
« Reply #7 on: September 20, 2012, 09:46:11 AM »
Another option: dynamic block - see attached dwg

Now I use a custom lisp that checks to see if the block exists, if not, imports it from a "standards" drawing then puts it on the A-Anno-Revs layer.  But maybe the dblock can get you started.

jb

thanks for the suggestion...
i finally managed to wrap up this this routine..

thanks to MR for the help

i added an option to make a polygonal revcloud too aside from this rectangular
"memories fade but the scars still linger"

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Help on my Rectangular RevCloud
« Reply #8 on: September 20, 2012, 09:57:09 AM »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Help on my Rectangular RevCloud
« Reply #9 on: September 20, 2012, 10:07:41 AM »
Thanks Ron, maybe I should add a Draw Option for Rectangle.
My draw pline is a vertex pick along route method.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Help on my Rectangular RevCloud
« Reply #10 on: September 20, 2012, 10:10:41 AM »
Thanks Ron, maybe I should add a Draw Option for Rectangle.
My draw pline is a vertex pick along route method.

I figured Command: POLYGON and then use the pick option in your routine would cover most anything :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

RolandOrzabal

  • Newt
  • Posts: 86
  • "memories fade but the scars still linger"
Re: Help on my Rectangular RevCloud
« Reply #11 on: September 20, 2012, 10:13:59 AM »
@Ron;

thanks! haven't seen that yet.
but i believe this routine needs a pre-drawn polyline (havent tried it yet)

i want to do the revcloud straight away without the pre-drawn polyline

@Cab;
i will try to post the routine tomorrow
am sure there will be many improvements on that coz am just new..

i will try out your code tomorrow too coz am on mobile now
"memories fade but the scars still linger"

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Help on my Rectangular RevCloud
« Reply #12 on: September 20, 2012, 02:23:32 PM »
I think you may like it. Uploading version 2.9 now which I added the Rectangle Draw option.
Be sure to extract the SLD file to your ACAD search path.

;;;  Files Required to be in the ACAD search path
;;;     pl2cloud.dcl  ; ***  note- created by this lisp
;;;     rc_normal.sld ; slides are found in the zip file
;;;     rc_shadow.sld
;;;     rc_length.sld
« Last Edit: September 20, 2012, 02:31:29 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

RolandOrzabal

  • Newt
  • Posts: 86
  • "memories fade but the scars still linger"
Re: Help on my Rectangular RevCloud
« Reply #13 on: September 20, 2012, 08:28:00 PM »
I think you may like it. Uploading version 2.9 now which I added the Rectangle Draw option.
Be sure to extract the SLD file to your ACAD search path.

;;;  Files Required to be in the ACAD search path
;;;     pl2cloud.dcl  ; ***  note- created by this lisp
;;;     rc_normal.sld ; slides are found in the zip file
;;;     rc_shadow.sld
;;;     rc_length.sld


WOW! that is very nice CAB!

if i've seen it before i wouldn't have the need to make mine :D
thanks a lot!

anyway, here's what i got

Code: [Select]
(defun c:RV ( / Dis1 Dis2 old_osm cmd1 PLW )
 (setq old_osm (getvar 'OSMODE ))
 (setq cmd1 (getvar "CMDECHO"))
 (setq PLW (getvar "plinewid"))
 (setvar "osmode" 0)
 (setvar "cmdecho" 0)
 (setvar "plinewid" 0)
 ;; thanks to ribarm for fixing this line
 (initget (+ 2 4))
(while (= Dis1 nil)
(setq Dis1 (getreal (if a (strcat "\nMin Arc Distance <" (rtos a) "> : ") "\nMin Arc Distance :")))
(if (null Dis1) (setq Dis1 a))
)
(while (= Dis2 nil)
(setq Dis2 (getreal (if b (strcat "\nMax Arc Distance - must be greater than " (rtos Dis1) " <" (rtos b) "> : ") (strcat "\nMax Arc Distance - must be greater than " (rtos Dis1) " : "))))
(if (null Dis2) (setq Dis2 b))
(if (< Dis2 Dis1) (setq Dis2 nil))
)
(setq a Dis1 b Dis2)
;; until this line as commented by ribarm
  (setq cont T)
    (while cont
        (setq cont nil)
        (initget "RN / RC / PN / PC / ?")
        (setq kw (getkword "\nRevcloud Style \nSelect option [ RN / RC / PN / PC / ?] <RN>:"))
(if (not kw) (setq kw "RN"))
        (cond
            ((= kw "RN") (C:NOD_RN))
            ((= kw "RC") (C:NOD_RC))
            ((= kw "PN") (C:NOD_PN))
            ((= kw "PC") (C:NOD_PC))
            ((= kw "?")
             (textscr)
             (alert
                 (strcat
                     "
OPTIONS:

   RN : Rectangular Revcloud in Normal Style
   RC : Rectangular Revcloud in Calligraphic Style
   PN : Polygonal Revcloud in Normal Style
   PC : Polygonal Revcloud in Calligraphic Style
   ")
             )
             (setq cont T)
            )
        )
    )
(setq Dis1 nil)
(setq Dis2 nil)
(setvar "plinewid" PLW)
(setvar "cmdecho" cmd1)
(setvar 'osmode old_osm)

)

(defun c:NOD_RN ()
(print "Rectangular Revcloud Normal Style Selected")
(setq pt1 (getpoint "\nFirst corner of revison cloud: "))
(setq pt2 (getcorner "\nDiagonal corner of revision cloud " pt1))
(command "._RECTANG" pt1 pt2)
(setq obj (entlast))
(command "._revcloud" "style" "n" "ARC" Dis1 Dis2 "OBJECT" obj "" )
)

(defun c:NOD_RC()
(print "Rectangular Revcloud Calligraphic Style Selected")
(setq pt1 (getpoint "\nFirst corner of revison cloud: "))
(setq pt2 (getcorner "\nDiagonal corner of revision cloud " pt1))
(command "._RECTANG" pt1 pt2)
(setq obj (entlast))
(command "._revcloud" "style" "C" "ARC" Dis1 Dis2 "OBJECT" obj "")
)

(defun C:NOD_PN ()
(prompt "\nPolygonal Revcloud Normal Style Selected\nPick Starting Point of Polyline and close when done:")
(command "_.PLINE")
(while (= (getvar "CMDNAMES") "PLINE")
(command pause)
)
(command "pedit" "l" "c" "")
(command "._revcloud" "style" "n" "ARC" Dis1 Dis2 "OBJECT" "l" "no")
)

(defun C:NOD_PC ()
(prompt "\nPolygonal Revcloud Calligraphic Style Selected\nPick Starting Point of Polyline and close when done:")
(command "_.PLINE")
(while (= (getvar "CMDNAMES") "PLINE")
(command pause)
)
(command "pedit" "l" "c" "")
(command "._revcloud" "style" "c" "ARC" Dis1 Dis2 "OBJECT" "l" "no")
)
(princ)

but still its ok.. i learn something from this anyway.
« Last Edit: September 20, 2012, 08:34:44 PM by NOD684 »
"memories fade but the scars still linger"

RolandOrzabal

  • Newt
  • Posts: 86
  • "memories fade but the scars still linger"
Re: Help on my Rectangular RevCloud
« Reply #14 on: September 21, 2012, 10:46:49 PM »
question :

why is the OSMODE value apprearing at the end of the routine?
"memories fade but the scars still linger"