Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Qleader settings by lisp?

7 REPLIES 7
Reply
Message 1 of 8
peterthomson
978 Views, 7 Replies

Qleader settings by lisp?

Is there any code about that enables Qleader settings to be "preset" without the use of the dialogue? Then I can add my layering bits and have a routine that is faster and works the way I want in every drawing with no extra input. Any assistance very much appreciated as always. Peter T.
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: peterthomson

Peter

 

Here is a lisp routine that I used in the
past.  It will give you the idea for your particular needs.  Basically
you need to setvar all the variables and then save the style to a
name.

 

I suggest that you muck around with your dimstyle
until you get what you want and then do a printout of all the dimvars to get the
relevant values.  the only fly in the ointment will be if you are
dimensioning in ms and need to set dimscale to whatever.

 

 

Good luck

 


--
Andrew
Nielsen           
;o)>

 

Andysan1@@bigpond.com
Remove
extra @ to send


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Is
there any code about that enables Qleader settings to be "preset" without the
use of the dialogue? Then I can add my layering bits and have a routine that
is faster and works the way I want in every drawing with no extra input. Any
assistance very much appreciated as always. Peter T.
Message 3 of 8
Anonymous
in reply to: peterthomson

peter, here is a routine that i've picked up
somewhere along the line....

 

 

cheers

 

mark


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Is
there any code about that enables Qleader settings to be "preset" without the
use of the dialogue? Then I can add my layering bits and have a routine that
is faster and works the way I want in every drawing with no extra input. Any
assistance very much appreciated as always. Peter T.
Message 4 of 8
Anonymous
in reply to: peterthomson

Mark's answer is on the track- Qleaders use a
dictionary to store variables- His file list most of them

 

As for Dim var's- why not  examine what's
proportional and set values accordingly 

(0/1 = off/on)  other values are either reals
or integers... and can be stored as symbols (setq's... .) and recalled to set in
proportion to one another rater than hard-coded.  as:

   (setvar "dimasz"(* 1.25 (getvar
dimtxt")))

 

 

 
Message 5 of 8
BobShumake
in reply to: peterthomson

This lisp sounds just like what I am looking for. When I click on the lisp it gives me a message "No Attachments"
am I doing something wrong? Would really like to get my hands on this code.

Thanks!
Message 6 of 8
Anonymous
in reply to: peterthomson

try this... this is just the code from the lisp
file

 

;;   
(ql-get)
;;      Returns an association list
containing the current QLEADER
;;      settings from
the Named Object Dictionary.
;;
;;    (ql-get
<alist>)
;;      Sets the specified values for
QLEADER settings from the given
;;      association
list.  Returns an association list containing
the
;;      new values.
;;
;;  These
functions can be used to examine the current QLEADER
;;  settings, or to
initialize the setting before using the QLEADER
;;  command.  For
example, to use splined leaders and framed text:
;;
;;   
(ql-set '((65 . 1)(72 . 1)))
;;
;;  Both functions use the following
group codes to identify QLEADER
;; 
settings:
;;
;;     3: user arrowhead block name
(default="")
;;    40: default text width
(default=0.0)
;;    60: annotation type
(default=0)
;;       
0=MText
;;        1=copy
object
;;       
2=Tolerance
;;       
3=block
;;       
4=none
;;    61: annotation reuse
(default=0)
;;       
0=none
;;        1=reuse
next
;;    62: left attachment point
(default=1)
;;    63: right attachment point
(default=3)
;;        0=Top of top
line
;;        1=Middle of top
line
;;        2=Middle of multiline
text
;;        3=Middle of bottom
line
;;        4=Bottom of bottom
line
;;    64: underline bottom line
(default=0)
;;    65: use splined leader line
(default=0)
;;    66: no limit on points
(default=0)
;;    67: maximum number of points
(default=3)
;;    68: prompt for MText width (word wrap)
(default=1)
;;    69: always left justify
(default=0)
;;    70: allowed angle, first segment
(default=0)
;;    71: allowed angle, second segment
(default=0)
;;        0=Any
angle
;;       
1=Horizontal
;;       
2=90deg
;;       
3=45deg
;;       
4=30deg
;;       
5=15deg
;;    72: frame text (default=0)
;;  
170: active tab (default=0)
;;       
0=Annotation
;;        1=Leader Line &
Arrow
;;       
2=Attachment
;;   340: object ID for annotation reuse

 

(DEFUN *ERROR* (MSG)
 
(PRINC)
)

 

(DEFUN QL-GET (/ XR COD ITM REPLY)
  (IF
(SETQ XR (DICTSEARCH (NAMEDOBJDICT) "AcadDim"))
   
(PROGN
      (FOREACH
COD
        '(3 40 60 61 62 63 64 65 66 67
68 69 70 71 72 170 340)
 (IF (SETQ ITM (ASSOC COD XR))
  
(SETQ REPLY (APPEND REPLY (LIST
ITM)))
 )
     
)
      REPLY
   
)
    '((3 . "")
      (40 .
0.0)
      (60 .
0)
      (61 . 0)
     
(62 . 1)
      (63 .
1)
      (64 . 0)
     
(65 . 1)
      (66 .
0)
      (67 . 3)
     
(68 . 0)
      (69 .
0)
      (70 . 0)
     
(71 . 0)
      (72 .
0)
      (170 . 0)
    
)
  )
)

 

(DEFUN QL-SET (ARG / CUR PRM)
  (SETQ CUR
(QL-GET))
  (WHILE ARG
    (SETQ PRM (CAR
ARG)
   ARG (CDR ARG)
   CUR (SUBST PRM (ASSOC (CAR
PRM) CUR) CUR)
    )
    (IF (= 3 (CAR
PRM))
      (SETVAR "DIMLDRBLK" (CDR
PRM))
    )
  )
  (DICTREMOVE (NAMEDOBJDICT)
"AcadDim")
  (SETQ
    CUR (APPEND '((0 .
"XRECORD") (100 . "AcDbXrecord") (90 .
990106))
  CUR
 )
  )
  (DICTADD
(NAMEDOBJDICT) "ACADDIM" (ENTMAKEX CUR))
  (QL-GET)
)

 

(DEFUN c:qlsettings (/  
ANNOTYPE    TXTWIDTH 
MTXTWDTH
       LJUSTIFY 
FRAMETXT    LATTPNT 
RATTPNT
       UBOTTOM 
ANNREUSE    USESPLIN 
MAXNMPNT
       NOLIMPNT 
ABLKNAME    FANGLE  SANGLE
     
)
  (INITGET "Mtext Copy Tolerance Block None _0 1 2 3 4")
 
(SETQ ANNOTYPE
  (GETKWORD
    "\nAnnotation type
[Mtext/Copy object/Tolerance/Block/None] <Mtext>: "
  )
 
)
  (IF (= ANNOTYPE NIL)
    (SETQ ANNOTYPE
"0")
  )
  (IF (= ANNOTYPE "0")
   
(PROGN
      (INITGET "No Yes _0
1")
      (SETQ TXTWIDTH
(GETKWORD
         "\nPrompt for
MText width [Yes/No] <Yes>: "
      
)
      )
      (IF (=
TXTWIDTH NIL)
 (SETQ TXTWIDTH "1")
     
)
      (IF (= TXTWIDTH
"1")
 (PROGN
   (INITGET 4)
  
(SETQ MTXTWDTH
   (GETREAL
     (STRCAT
"\nDefault text width <"
      (RTOS 0.0 (GETVAR
"LUNITS") (GETVAR "LUPREC"))
      ">:
"
     )
   )
  
)
 )
     
)
      (IF (= MTXTWDTH NIL)
 (SETQ MTXTWDTH
0.0)
      )
     
(INITGET "No Yes _0 1")
     
(SETQ
 LJUSTIFY (GETKWORD "\nAlways left justify [Yes/No] <No>:
")
      )
      (IF (=
LJUSTIFY NIL)
 (SETQ LJUSTIFY "0")
     
)
      (INITGET "No Yes _0
1")
      (SETQ FRAMETXT (GETKWORD "\nFrame text
[Yes/No] <No>: "))
      (IF (= FRAMETXT
NIL)
 (SETQ FRAMETXT "0")
     
)
      (INITGET "TT MT MM MB BB _0 1 2 3
4")
     
(SETQ
 LATTPNT (GETKWORD
    "\nLeft attachment
point [TT/MT/MM/MB/BB] <MT>:
"
  )
     
)
      (IF (= LATTPNT NIL)
 (SETQ LATTPNT
"1")
      )
     
(INITGET "TT MT MM MB BB _0 1 2 3 4")
     
(SETQ
 RATTPNT (GETKWORD
    "\nRight attachment
point [TT/MT/MM/MB/BB] <MM>:
"
  )
     
)
      (IF (= RATTPNT NIL)
 (SETQ RATTPNT
"3")
      )
     
(INITGET "No Yes _0 1")
      (SETQ
UBOTTOM
      (GETKWORD "\nUnderline bottom line
[Yes/No] <No>: ")
     
)
      (IF (= UBOTTOM NIL)
 (SETQ UBOTTOM
"0")
      )
    )
 
)
  (INITGET "None Reuse _0 1")
  (SETQ ANNREUSE
 
(GETKWORD "\nAnnotation reuse [None/Reuse next] <None>: "
 
)
  )
  (IF (= ANNREUSE NIL)
    (SETQ
ANNREUSE "0")
  )
  (INITGET "No Yes _0 1")
  (SETQ
USESPLIN (GETKWORD "\nUse splined leader [Yes/No] <No>: "))
  (IF
(= USESPLIN NIL)
    (SETQ USESPLIN "0")
  )
 
(INITGET 6)
  (SETQ
    MAXNMPNT (GETINT "\nNumber of
points or <Enter> for no limit: ")
  )
  (IF (= MAXNMPNT
NIL)
    (PROGN
      (SETQ
MAXNMPNT "2")
      (SETQ NOLIMPNT
"1")
    )
  )
  (SETQ ABLKNAME
 
(GETKWORD
    "\nUser arrowhead block name or <Enter>
for none: "
  )
  )
  (IF (= ABLKNAME
NIL)
    (SETQ ABLKNAME "")
  )
  (INITGET
"Any Horizontal 90 45 30 15 _0 1 2 3 4 5")
  (SETQ FANGLE
 
(GETKWORD
    "\nFirst segment angle constraint [Any
angle/Horizontal/90/45/30/15] <Any>: "
  )
  )
 
(IF (= FANGLE NIL)
    (SETQ FANGLE "0")
  )
 
(INITGET "Any Horizontal 90 45 30 15 _0 1 2 3 4 5")
 
(SETQ SANGLE
  (GETKWORD
    "\nSecond segment
angle constraint [Any angle/Horizontal/90/45/30/15] <Any>: "
 
)
  )
  (IF (= SANGLE NIL)
    (SETQ SANGLE
"0")
  )
  (QL-SET
    (LIST (CONS 3
ABLKNAME)
   (CONS 40 MTXTWDTH)
   (CONS 60 (ATOI
ANNOTYPE))
   (CONS 61 (ATOI ANNREUSE))
   (CONS 62
(ATOI LATTPNT))
   (CONS 63 (ATOI RATTPNT))
   (CONS
64 (ATOI UBOTTOM))
   (CONS 65 (ATOI USESPLIN))
  
(CONS 66 (ATOI NOLIMPNT))
   (CONS 67 (ATOI
MAXNMPNT))
   (CONS 68 (ATOI TXTWIDTH))
   (CONS 69
(ATOI LJUSTIFY))
   (CONS 70 (ATOI FANGLE))
   (CONS
71 (ATOI SANGLE))
   (CONS 72 (ATOI FRAMETXT))
  
(CONS 170 0)
    )
  )
 
(PRINC)
)

 

 

 

 

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
This
lisp sounds just like what I am looking for. When I click on the lisp it gives
me a message "No Attachments"
am I doing something wrong? Would really
like to get my hands on this code.

Thanks!

Message 7 of 8
BobShumake
in reply to: peterthomson

Thanks Mark,

Can't wait to try this.
Message 8 of 8
peterthomson
in reply to: peterthomson

Mark, my sincere apologies for not responding sooner...many thanks for your trouble, I'll see what I can make of it. Cheers, PT

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost