Jump to content

Recommended Posts

Posted

Hi, Good day to you all.I'm new to this forum. I hope you people can help me out.

 

I'm working on, automatic creation of title block with required scale setting in 'Model space' not in layout.

 

by clicking a button or comment, it should ask the user to select the 'title blocks' among the list, which is in 1:1 scale.

 

Then it should ask the user to select the scale among '1:2, 1:10, 1:20'. once selected it should scale the title block(eg. if 1:10 selected entire title block to be scaled to 10). also the size of dimension arrow and text size to be changed accordingly.

 

Also we have a set of 10 drawing each as a blocks in it which we will be using as symbols on drawings. that should also get scaled accordingly whenever they gets inserted.

 

please help.o:)

Posted

Why bother using AutoCAD 2014 then? Might as well be using release 9.

Posted

it is not up to me. My organisation is little reluctant to get updated:unsure:

Posted

Try updating to layouts as the 1st step, will open a whole new world of simplicity.

Posted
Try updating to layouts as the 1st step, will open a whole new world of simplicity.

 

I suggested it already, yet they want in that way..

Posted

I'll look around in some of my old LISPs when I get home tonight and see if I have something, like others this is ancient stuff, but it was a common request quite a while back. A good search should bring up something from way back.

 

You might could handle this with a dynamic block with visibility states for the different scales.

Posted

after some searches i came across with with some idea. i'm trying to create a lisp myself. which i never did before. I'm thinking of incorporating there two command lines in the lisp. looks simple two use them. however i'm stuck with automatic scaling of block...

 

(command "insert" "C:\\Users\\DE14\\Desktop\\A1 horizondal test.dwg" "0,0,0" "1" "1" "0" "_.explode" "_L")

(command "-purge" "B" "YourBlockName" "N" "")

 

also i came across with autocad cui. and reading about them now. and i'm very much close to the solution. But the 'scale' thing is not moving...

Posted
I suggested it already, yet they want in that way..

 

No offense, but any organization that can't update to layouts almost 20 years later, is probably way behind in many other ways too.

I'd be looking for another job.

 

Good luck.

Posted
No offense, but any organization that can't update to layouts almost 20 years later, is probably way behind in many other ways too.

I'd be looking for another job.

 

Good luck.

 

 

haha , that sounds familiar! @my work we can (and do) use layouts but... our document control program , DvTDM release 2010 , can't (so says upper control smurf) read our titleblocks in paper space (yeah right).

Posted
Rlx is it 1 dwg per sheet as well ? :lol:

 

sadly but yes....

Posted

just some lunch fun to get you started. Kept it as simple as possible. All could be done by dialog and / or automatically show all filenames in your template folder etc. Wanted to post earlier but major W10 update stopped me from doing anything for 3-4 hours.

 

 

(defun c:Captain_Ahap  ( / SizeList ScaleList size scale titleblockfolder titleblock)
 (vl-load-com)
 ; some shortcuts for titleblock / border sizes (without the full path)
 (setq SizeList  (list "A0" "A1" "A2" "A3" "A4-L" "A4-P")
ScaleList (list 1 10 50 100)
titleblockfolder "c:/temp/mytitleblockfolder/"
 )
 (if (and (setq size  (CycleList "Choose titleblock size" SizeList))
   (setq scale (CycleList "Choose titleblock scale" ScaleList)))
   (progn
     ; maybe translate size to filename first
     (cond ((eq size   "A0") (setq titleblock (strcat titleblockfolder "A0_horizondal_test.dwg")))
    ((eq size   "A1") (setq titleblock (strcat titleblockfolder "A1_horizondal_test.dwg")))
    ((eq size   "A2") (setq titleblock (strcat titleblockfolder "A2_horizondal_test.dwg")))
    ((eq size   "A3") (setq titleblock (strcat titleblockfolder "A3_horizondal_test.dwg")))
    ((eq size "A4-L") (setq titleblock (strcat titleblockfolder "A4_Landscape_test.dwg")))
    ((eq size "A4-P") (setq titleblock (strcat titleblockfolder "A4_Portrait_test.dwg")))
     )
     (if (and titleblock (findfile titleblock) (numberp scale))
(progn
  (setvar 'expert 2) (setvar 'cmdecho 0) (setvar 'attreq 0)
  (command "-insert" titleblock (list 0 0 0) scale scale 0)
  (command "_.explode" "_L")
  (command "-purge" "B" "YourBlockName" "N")
  (command "._zoom" "e")
)
(alert "Unable to insert titleblock")
     )
   )
 )
 (princ)
)

; example1 (setq choise (CycleList "Choose titleblock size" '("A0" "A1" "A2" "A3" "A4")))
; example2 (setq choise (CycleList "Choose titleblock scale" '(1 10 50 100)))
(defun CycleList (msg lst / inp loop rtn)
 (setq loop t)
 (while loop
   (princ "\nCycle list with tab or L-mouse / accept use enter,space or R-mouse / Esc or x for exit\n")
   (princ (strcat "\r" msg " <" (vl-princ-to-string (car lst)) "> : "))
   (setq inp (vl-catch-all-apply 'grread (list nil 8 0)))
   (if (vl-catch-all-error-p inp)
     (progn (princ "\nTitleblock insertion cancelled")(setq rtn nil loop nil))
     (progn
       (cond
         ;tab
         ((or (equal inp '(2 9))(= (car inp) 3))
          (setq lst (append (cdr lst)(list (car lst))))
          (princ (strcat "\r" msg " <" (vl-princ-to-string (car lst)) "> : ")))
         ;enter,space,r-mouse
         ((or (equal inp '(2 13)) (equal inp '(2 32))(= (car inp) 25))
          (setq rtn (car lst) loop nil))
         ;x or X
         ((member inp '((2 88)(2 120)))(setq rtn nil loop nil))
       )
     )
   )
 )
 (terpri)
 rtn
)
; start command with (c:Captain_Ahap)

well , (work)day is done , so I'm gone ... with the wind (or the waves since you're obviously have a fishy thing ;-)

 

 

gr. Rlx

Posted
just some lunch fun to get you started. Kept it as simple as possible. All could be done by dialog and / or automatically show all filenames in your template folder etc. Wanted to post earlier but major W10 update stopped me from doing anything for 3-4 hours.

 

 

(defun c:Captain_Ahap  ( / SizeList ScaleList size scale titleblockfolder titleblock)
 (vl-load-com)
 ; some shortcuts for titleblock / border sizes (without the full path)
 (setq SizeList  (list "A0" "A1" "A2" "A3" "A4-L" "A4-P")
ScaleList (list 1 10 50 100)
titleblockfolder "c:/temp/mytitleblockfolder/"
 )
 (if (and (setq size  (CycleList "Choose titleblock size" SizeList))
   (setq scale (CycleList "Choose titleblock scale" ScaleList)))
   (progn
     ; maybe translate size to filename first
     (cond ((eq size   "A0") (setq titleblock (strcat titleblockfolder "A0_horizondal_test.dwg")))
    ((eq size   "A1") (setq titleblock (strcat titleblockfolder "A1_horizondal_test.dwg")))
    ((eq size   "A2") (setq titleblock (strcat titleblockfolder "A2_horizondal_test.dwg")))
    ((eq size   "A3") (setq titleblock (strcat titleblockfolder "A3_horizondal_test.dwg")))
    ((eq size "A4-L") (setq titleblock (strcat titleblockfolder "A4_Landscape_test.dwg")))
    ((eq size "A4-P") (setq titleblock (strcat titleblockfolder "A4_Portrait_test.dwg")))
     )
     (if (and titleblock (findfile titleblock) (numberp scale))
(progn
  (setvar 'expert 2) (setvar 'cmdecho 0) (setvar 'attreq 0)
  (command "-insert" titleblock (list 0 0 0) scale scale 0)
  (command "_.explode" "_L")
  (command "-purge" "B" "YourBlockName" "N")
  (command "._zoom" "e")
)
(alert "Unable to insert titleblock")
     )
   )
 )
 (princ)
)

; example1 (setq choise (CycleList "Choose titleblock size" '("A0" "A1" "A2" "A3" "A4")))
; example2 (setq choise (CycleList "Choose titleblock scale" '(1 10 50 100)))
(defun CycleList (msg lst / inp loop rtn)
 (setq loop t)
 (while loop
   (princ "\nCycle list with tab or L-mouse / accept use enter,space or R-mouse / Esc or x for exit\n")
   (princ (strcat "\r" msg " <" (vl-princ-to-string (car lst)) "> : "))
   (setq inp (vl-catch-all-apply 'grread (list nil 8 0)))
   (if (vl-catch-all-error-p inp)
     (progn (princ "\nTitleblock insertion cancelled")(setq rtn nil loop nil))
     (progn
       (cond
         ;tab
         ((or (equal inp '(2 9))(= (car inp) 3))
          (setq lst (append (cdr lst)(list (car lst))))
          (princ (strcat "\r" msg " <" (vl-princ-to-string (car lst)) "> : ")))
         ;enter,space,r-mouse
         ((or (equal inp '(2 13)) (equal inp '(2 32))(= (car inp) 25))
          (setq rtn (car lst) loop nil))
         ;x or X
         ((member inp '((2 88)(2 120)))(setq rtn nil loop nil))
       )
     )
   )
 )
 (terpri)
 rtn
)
; start command with (c:Captain_Ahap)

well , (work)day is done , so I'm gone ... with the wind (or the waves since you're obviously have a fishy thing ;-)

 

 

gr. Rlx

 

Thank you rlx.It works nice. will be using the 'support' folder in c instead of temp.

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