Jump to content

Revision cloud lisp with custom rotation of revision block on temporarily layer


fromMlm

Recommended Posts

I found this nice revision cloud lisp made by Lee Mac:

 

(defun c:rv ( / *error* ar bn cm el fn rv )

   (setq bn "revlsp") ;; Rev Cloud Attributed Block
   
   (defun *error* ( msg )
       (if cm (setvar 'cmdecho cm))
       (if ar (setvar 'attreq ar))
       (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
           (princ (strcat "\nError: " msg))
       )
       (princ)
   )

   (setq cm (getvar 'cmdecho)
         ar (getvar 'attreq)
   )
   (cond
       (   (not
               (or (tblsearch "BLOCK" bn)
                   (and
                       (setq fn (findfile (strcat bn ".dwg")))
                       (progn
                           (setvar 'cmdecho 0)
                           (command "_.-insert" fn nil)
                           (setvar 'cmdecho cm)
                           (tblsearch "BLOCK" bn)
                       )
                   )
               )
           )
           (princ (strcat "\n" bn ".dwg not found."))
       )
       (   (zerop (logand 2 (cdr (assoc 70 (tblsearch "BLOCK" bn)))))
           (princ (strcat "\n" bn " not attributed."))
       )
       (   (setq *rev*
               (cond
                   (   (= "" (setq rv (getstring t (strcat "\nSpecify Revision" (if *rev* (strcat " <" *rev* ">: ") ": ")))))
                       *rev*
                   )
                   (   rv   )
               )
           ) 
           (initcommandversion)                    
           (command-s "_.revcloud")
           (while (= 1 (logand 1 (getvar 'cmdactive))) (command "\\"))
           (setvar 'cmdecho 0)
           (setvar 'attreq  0)
           (setq el (entlast))
           
           (command "_.-insert" bn "_S" 1.0 "_R" 0.0 "\\")
           (if (not (eq el (setq el (entlast))))
               (progn
                   (setq el (entget (entnext el)))
                   (if (entmod (subst (cons 1 *rev*) (assoc 1 el) el))
                       (entupd (cdr (assoc -1 el)))
                   )
               )
           )
           (setvar 'attreq  ar)
           (setvar 'cmdecho cm)
       )
   )    
   (princ)
)
(princ)

 

What I wish to do is:
1. Set the insertion point with variable rotation using osnap nearest and then back to current osnaps

 

2. -  Save current layer/working layer.

     - Then temporarily change to a new given layer but change colour on the revision cloud to cyan (not the block)

     - Do the revision cloud and the insert.

     - Finally change back to my working layer. (in my case "K596 - Revideringsmoln")

 

example.JPG.c50ed8ba8d7af30e8ad83362e252dba6.JPG

 

REVLSP.dwg

 

I have tried to delete the 0.0

(command "_.-insert" bn "_S" 1.0 "_R"  "\\")

It just allows me to rotate the block and then place it. And the revision do not show. I would like to place first and then rotate.

 

example2.JPG.165e2fe665310083f479fe1cc12bb7f4.JPG

 

How do I specify the insert point for the block so I can rotate it?

 

Link to comment
Share on other sites

"How do I specify the insert point for the block so I can rotate it?" A block is normally rotated around its insertion point when using "INSERT" you can rotate a block after its inserted and have a different base point for the rotation. So if you know the block relationship to a new base point and insertion point then yes can be done via a simple lisp.Insert then rotate.

Link to comment
Share on other sites

Thanks for the replay BIGAL!

 

What I wished for was to use Lee Macs revision lisp and modify it, so I can rotate my revision block.

This part in the lisp seems to be the part I have to modify:

(command "_.-insert" bn "_S" 1.0 "_R" 0.0 "\\")

If I understand this part of the code, 0.0 is a fixed angle. So I deleted 0.0 to see if it made the rotation flexible. But it didn't quite do what I wanted...(the revison didn't shoe e.g.)

Do I need to create another variable like "pt" and put it into the code above? Or how do I alter this code part to suite what I wish for?

 

Here is an example I found where pt is present :
 

(setq pt (getpoint "\nSpecify insertion point (or Enter to stop) : \n"))
(command "-insert" bname pt 1 1 0)

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi again

Is there anybody who could help me tweak the above menstioned Lisp? I think it must be this row that has to be altered.

(command "_.-insert" bn "_S" 1.0 "_R" 0.0 "\\")

 

Link to comment
Share on other sites

You can use pause to enter angle or something like this allows onscreen dragging of angle.

 

(command-s "_.-insert" bn "_S" 1.0 (getpoint "\nPick point for insertion "))

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...