Jump to content

Fixing attdia


Lt Dan's legs

Recommended Posts

I'm trying to get the attdia to toggle in a better way. If you hit escape when you're done the attdia will stay at 0. My coworkers are escape happy.. Any ideas?

 

 

(defun c:RB (/ ip)

(if (setq *count* (getint "\nStarting number: "))

(progn

-[Do your thing here...]

);progn

);if

(setvar 'attdia 0)

(while (setq ip (getpoint "\nInsertion Point: "))

(command

"_.insert"

"WALLBALL3" ; your block name

ip

"1.4" "1.4" "0" ; scales/rotation defaults

(strcat "R" (itoa *count*))

); end command

(setq *count* (1+ *count*))

); end while

(setvar 'attdia 1)

);

 

_____

Previously named REID7800

Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • Lt Dan's legs

    11

  • Lee Mac

    7

  • alanjt

    2

Top Posters In This Topic

I must be doing something wrong. My attdia doesn't turn off when i hit escape but my coworkers still have this problem.

Link to comment
Share on other sites

A most excellent name! LoL

 

I have to admit I stole it from a local trivia team. I thought it was too great not to use.

Link to comment
Share on other sites

Yes but I'm not sure what goes where. I don't know much about the language at all. There are no courses here at my local college so I'm trying to teach myself... it's not going so well. I thought I had some of it figured out but I see that I'm wrong.

Link to comment
Share on other sites

If you were to use this code:

 

(defun c:InsertBlock ( / block tag space point )
 (vl-load-com)
 ;; Lee Mac  ~  05.05.10

 (setq block "PANEL") ;; Block Name or nil

 (setq tag nil)   ;; Tag Name or nil

 (setq space
   (if
     (or
       (eq AcModelSpace
         (vla-get-ActiveSpace
           (setq doc
             (vla-get-ActiveDocument
               (vlax-get-acad-object)
             )
           )
         )
       )
       (eq :vlax-true
         (vla-get-MSpace doc)
       )
     )
     (vla-get-ModelSpace doc)
     (vla-get-PaperSpace doc)
   )
 )        

 (if
   (and
     (setq block (GetBlock block))
     (setq *num*
       (1-
         (cond
           (
             (getint
               (strcat "\nSpecify Starting Number <"
                 (itoa
                   (setq *num*
                     (cond ( *num* ) ( 1 ))
                   )
                 )
                 "> : "
               )
             )
           )
           ( *num* )
         )
       )
     )
   )

   (while
     (setq *num* (1+ *num*)
           point (getpoint "\nSpecify Point for Insertion: "))
     
     (if (and (setq obj (InsertBlock space block point)) tag)
       (PutAttValue obj tag (itoa *num*))
     )
   )
 )
 
 (princ)
)

(defun PutAttValue ( object tag value )
 ;; Lee Mac  ~  05.05.10
 (mapcar
   (function
     (lambda ( attrib )
       (and
         (eq tag (vla-get-TagString attrib))
         (vla-put-TextString attrib value)
       )
     )
   )
   (vlax-invoke object 'GetAttributes)
 )
 value
)

(defun GetBlock ( block )
 ;; Lee Mac  ~  05.05.10
 (cond
   (
     (not
       (and
         (or block
           (setq block
             (getfiled "Select Block" "" "dwg" 16)
           )
         )
         (or
           (and
             (vl-position
               (vl-filename-extension block) '("" nil)
             )
             (or
               (tblsearch "BLOCK" block)
               (setq block
                 (findfile
                   (strcat block ".dwg")
                 )
               )
             )
           )
           (setq block (findfile block))
         )
       )
     )
    nil
   )
   ( block )
 )
)

(defun InsertBlock ( Block Name Point )
 (if
   (not
     (vl-catch-all-error-p
       (setq result
         (vl-catch-all-apply (function vla-insertblock)
           (list Block (vlax-3D-point point) Name 1. 1. 1. 0.)
         )
       )
     )
   )
   result
 )
)

 

You would just need to change the block/tag name at the very top - the rest shouldn't need to change.

Link to comment
Share on other sites

Yes I'm using this code but when I insert the block the number that should be counting does not show

Link to comment
Share on other sites

When I did the code with "LONG WALL" it just removes all dynamic properties in the block. Why would that happen? I have another code that works great for me, I just accidently put "long wall" into this code and that's what happened

 

(defun c:InsertBlock ( / block tag space point )

(vl-load-com)

;; Lee Mac ~ 05.05.10

 

(setq block "long wall") ;; Block Name or nil

 

(setq tag nil) ;; Tag Name or nil

 

(setq space

(if

(or

(eq AcModelSpace

(vla-get-ActiveSpace

(setq doc

(vla-get-ActiveDocument

(vlax-get-acad-object)

)

)

)

)

(eq :vlax-true

(vla-get-MSpace doc)

)

)

(vla-get-ModelSpace doc)

(vla-get-PaperSpace doc)

)

)

 

(if

(and

(setq block (GetBlock block))

(setq *num*

(1-

(cond

(

(getint

(strcat "\nSpecify Starting Number

(itoa

(setq *num*

(cond ( *num* ) ( 1 ))

)

)

"> : "

)

)

)

( *num* )

)

)

)

)

 

(while

(setq *num* (1+ *num*)

point (getpoint "\nSpecify Point for Insertion: "))

 

(if (and (setq obj (InsertBlock space block point)) tag)

(PutAttValue obj tag (itoa *num*))

)

)

)

 

(princ)

)

 

(defun PutAttValue ( object tag value )

;; Lee Mac ~ 05.05.10

(mapcar

(function

(lambda ( attrib )

(and

(eq tag (vla-get-TagString attrib))

(vla-put-TextString attrib value)

)

)

)

(vlax-invoke object 'GetAttributes)

)

value

)

 

(defun GetBlock ( block )

;; Lee Mac ~ 05.05.10

(cond

(

(not

(and

(or block

(setq block

(getfiled "Select Block" "" "dwg" 16)

)

)

(or

(and

(vl-position

(vl-filename-extension block) '("" nil)

)

(or

(tblsearch "BLOCK" block)

(setq block

(findfile

(strcat block ".dwg")

)

)

)

)

(setq block (findfile block))

)

)

)

nil

)

( block )

)

)

 

(defun InsertBlock ( Block Name Point )

(if

(not

(vl-catch-all-error-p

(setq result

(vl-catch-all-apply (function vla-insertblock)

(list Block (vlax-3D-point point) Name 1. 1. 1. 0.)

)

)

)

)

result

)

)

Link to comment
Share on other sites

THANKS!! I was wondering how everyone was doing that. I didn't know I had to change that. Thanks. I know very little about lisp. I'm sure it's showing now. What lisp strings I do have has been writen for me or I have had lots of help.

Link to comment
Share on other sites

I'm not sure why it would strip the Dynamic Properties - there is nothing in the code to do that. But glad the lightbulb came on. :)

Link to comment
Share on other sites

While I have you here, I've checked out your " Incremental Numbering Suite" & I was thinking about doing something like this myself. I've wanted to do a window like this. It would create a box like this. See dwg.

 

Where would I start? I'm not looking for something like this to be done for me. I'm just wondering if there was a place I could acquire the knowledge from. Like I said before the colleges around here do not offer a course on lisp. Would it be better to do this in VB?

Link to comment
Share on other sites

Guest capling006

x Not every man had actually left the United States get into the kind of fierce Puma large whiskers, the downcast, I, my husband decided to resume his light chin, turned and his long absence, electric shavers not, and wait until they finally confessed to his wife before that, the electric razor morning she lost, bad idea that

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...