Author Topic: \" symbol string..  (Read 4332 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
\" symbol string..
« on: May 29, 2006, 01:57:40 PM »
Hi all...
i'm trying to create a routine to allow user to reset automaticly the QLEADER setting..

Code: [Select]
;;;;;;;;;;Réajustement des variables du Qleader
(defun setQleader (/ QLSf)
(setq QLSr (vl-registry-read "HKEY_CURRENT_USER\\Software\\Qleader\\Setting"))
(setq QLSf (dictsearch (namedobjdict) "AcadDim"))
(if (and QLSr (/= QLSr QLSf)) (ChangeQleaderSetting))
)
;;************************;
;
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ChangeQleaderSetting (/ QLS)
(if (dictsearch (namedobjdict) "AcadDim")
(dictremove (namedobjdict) "AcadDim")
)
(dictadd (namedobjdict) "AcadDim" QLSr)
)
;;************************;
;
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:Qleadsetup (/ QLS)
(setvar "CMDECHO" 0)
(command "_Qleader" "_S" cancel)
(princ)
(setq QLS (dictsearch (namedobjdict) "AcadDim"))
(vl-registry-write "HKEY_CURRENT_USER\\Software\\Qleader\\Setting" "" (vl-prin1-to-string QLS))
(setQleader)
)
;
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setQleader)

But in this code I have the \" symbol conversion problem...
and can't find how to resolve this..

any idea ?
Keep smile...

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: \" symbol string..
« Reply #1 on: May 29, 2006, 02:03:43 PM »
Can you use "/" ... I know it works for paths but I do not know about registry settings. You could also attempt to use the char number instead and have it convert in the lisp.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Andrea

  • Water Moccasin
  • Posts: 2372
Re: \" symbol string..
« Reply #2 on: May 29, 2006, 04:08:52 PM »
Code: [Select]
(setq QLSr (vl-registry-read "HKEY_CURRENT_USER\\Software\\Qleader\\Setting"))result =
Code: [Select]
"((-1 . <Nom d'entité: 7efb5f30>) (0 . \"XRECORD\") (5 . \"9E\") (102 . \"{ACAD_REACTORS\") (330 . <Nom d'entité: 7efb5c60>) (102 . \"}\") (330 . <Nom d'entité: 7efb5c60>) (100 . \"AcDbXrecord\") (280 . 1) (90 . 990106) (3 . \"\") (60 . 0) (61 . 0) (62 . 0) (63 . 0) (64 . 0) (65 . 0) (66 . 0) (67 . 3) (68 . 1) (69 . 0) (70 . 0) (71 . 0) (72 . 0) (40 . 0.0) (170 . 2))"
But Iin the registry seem correct.
(see picture)

So he question is...how can i use the:
Code: [Select]
(dictadd (namedobjdict) "AcadDim" QLSr)method ?
Keep smile...

Sdoman

  • Guest
Re: \" symbol string..
« Reply #3 on: May 29, 2006, 06:41:55 PM »
If you don't need the enames in the association list, then you can avoid the error by removing all sublists containing enames before writing to the Registry:

Code: [Select]

(setq QLS (vl-remove-if '(lambda (x)(= (type (cdr x)) 'ENAME)) (dictsearch (namedobjdict) "AcadDim")))


kpblc

  • Bull Frog
  • Posts: 396
Re: \" symbol string..
« Reply #4 on: May 30, 2006, 12:16:50 AM »
I've got only one question - why son't create leader object using vla-functions? In this case you don't need to create or modify dictionary object, you're working directly with leader object. It isn't very difficult, I think.
Sorry for my English.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: \" symbol string..
« Reply #5 on: May 30, 2006, 12:58:10 PM »
I've got only one question - why son't create leader object using vla-functions? In this case you don't need to create or modify dictionary object, you're working directly with leader object. It isn't very difficult, I think.

make a function to create new QLEADER not bad idea..
but we need to use same function for diffrent QLEADER setting.

So the idea is, to set QLEADER setting at the initial value..(windows registry).
Keep smile...

kpblc

  • Bull Frog
  • Posts: 396
Re: \" symbol string..
« Reply #6 on: May 31, 2006, 03:32:19 AM »
If you really want to change qleader settings
During translation code formatting has been erased, so I'll repeat it:
Code: [Select]
;| Task: To have in the root dictionary record (xrecord), with the name "NLEADER",
which in reality on the size of data presentation it corresponds to the record "AcadDim"
 — by that, which is created for itself command QLEADER stores in it tuning user, assigned
in appropriate of d/okne.
At the necessary moment of time the record "AcadDim" is re-named in "QLEADERBACK",
and record "NLEADER" -  in "AcadDim".
After fulfillment from the program- shell of the command _ of..tsleader it is necessary not to
forget to produce; reverse renaming to return "AcadDim" to the initial form
Fragments of the code:
The creation of X-record, (if it still don't exist in file)|;
  (setq rootnm (namedobjdict)); root dict name
  (cond
    ((not (dictsearch rootnm "NLEADER")); there is no QLEADER settings
     (command "_.qleader")(command);
     (setq qlrec (dictsearch rootnm "AcadDim"))
     (dictadd
       rootnm
       "NLEADER"
       (entmakex (append '((0 . "XRECORD")(100 . "AcDbXrecord"))
       (list (assoc 90 qlrec)(assoc 3 qlrec))
       '((60 . 4);
         (62 . 2);
         (63 . 0);
         (65 . 0);
         (67 . 2);
         (64 . 0)(61 . 0)(66 . 1)(68 . 0)(69 . 0)(70 . 0)(71 . 0)(72 . 0)(40 . 0.0)
         (91 . 1);
         (92 . 0);
       )
      ); end append.
       ); end entmakex.
     ); end dictadd.
    );
  ); end cond.

  ; test:
  (cond
    ((setq qlback (dictsearch rootnm "QLEADERBACK"));
     (dictremove rootnm "QLEADERBACK");
     (entdel (cdr (assoc -1 qlback)));
    );
  ); end cond.


  ; rename x-records
  (command "_.qleader")(command);
  (dictrename rootnm "AcadDim" "QLEADERBACK")
  (dictrename rootnm "NLEADER" "AcadDim")
  ;
  (setq qlrec (dictsearch rootnm "AcadDim"));
« Last Edit: May 31, 2006, 02:23:59 PM by CAB »
Sorry for my English.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: \" symbol string..
« Reply #7 on: May 31, 2006, 02:47:37 PM »
Thanks kpblc.
I was able to reformat herdsman's original post.
Code: [Select]
  ; Task:
  ; To have in the root dictionary record (xrecord), with the name "NLEADER", which in reality
  ; on the size of data presentation it corresponds to the record "AcadDim" - by that, which is created for itself
  ; command QLEADER stores in it tuning user, assigned in appropriate of d/okne.
  ; At the necessary moment of time the record "AcadDim" is re-named in "QLEADERBACK", and record "NLEADER" - in "AcadDim".
  ; After fulfillment from the program- shell of the command _ of..tsleader it is necessary not to forget to produce
  ; reverse renaming to return "AcadDim" to the initial form
  ; Fragments of the code:
  ; The creation of X- record, if not in the document:
(setq rootnm (namedobjdict)) ; the name of the object of root dictionary.
(cond ((not (dictsearch rootnm "NLEADER")) ; they are not found tuning NLEADER: (command "_..tsleader")(.chommand)
       ;; the initialization of regular X- record "AcadDim",
       ;; if the same does not be present in the figure.
       (setq qlrec (dictsearch rootnm "AcadDim"))
       (dictadd rootnm
                "NLEADER"
                (entmakex (append '((0. "XRECORD") (100. "AcDbXrecord"))
                                  (list (assoc 90 qlrec) (assoc 3 qlrec))
  ; the designation of codes 90 and 3 4 I do not know,
  ; without them in me command QLEADER rejected to receive the created record; for the "native"
  ; therefore 4 these data simply I copy from the regular X- record.
                                  '((60. 4)  ; without the annotation.
                                    (62 . 2) ; vert. levelling off (0 - 4).
                                    (63 . 0) ; 0 - to emphasize, 1 - framework.
                                    (65 . 0) ; the type of the segments . of severing.
                                    (67 . 2) ; the number of points of indication.
                                    (64 . 0)
                                    (61 . 0)
                                    (66 . 1)
                                    (68 . 0)
                                    (69 . 0)
                                    (70 . 0)
                                    (71 . 0)
                                    (72 . 0)
                                    (40 . 0.0)
                                    (91 . 1)  ; Option of conversion (prefix).
                                    (92 . 0)  ; Option of conversion (suffix).
                                   )
                          ) ; end append.
                ) ; end entmakex.
       ) ; end dictadd.
      ) ;
) ; end cond.
  ; Checking:
(cond ((setq qlback (dictsearch rootnm "QLEADERBACK")))
      ;; theoretically this record there must not be with the regular
      ;; the completion of the last call of command, since this record had to be conversely renamed in "AcadDim".
      ;; But if suddenly this not then:
      (dictremove rootnm "QLEADERBACK") ; disconnection from the dictionary: this possible and optional action?
      (entdel (cdr (assoc -1 qlback)))  ; the removal of X- record as primitive);
) ; end cond.
  ; Renaming the X- records: (command "_..tsleader")(.chommand)
  ; the initialization of X- record "AcadDim", if the same does not be present in the figure.
(dictrename rootnm "AcadDim" "QLEADERBACK")
(dictrename rootnm "NLEADER" "AcadDim")
(setq qlrec (dictsearch rootnm "AcadDim")) ; now in the X- record "AcadDim" they are contained my tuning.
« Last Edit: June 01, 2006, 09:48:11 AM 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.

kpblc

  • Bull Frog
  • Posts: 396
Re: \" symbol string..
« Reply #8 on: June 01, 2006, 02:40:51 AM »
And remember - I am not the author of original post (at autocad.ru).
Some ideas for create leader thought vla-functions (it's my core function, you can use something like it to create any kind of leaders).
Code: [Select]
;;; Written by kpblc at 2006 Feb 12
(setq *kpblc-activedoc* (vla-get-activedocument (vlax-get-acad-object)))

;;; Creates a leader object with mtext annotation. Returns vla-pointer to created
;;; object
;;;    Call parameters:
;;; mtext-string String placed in annotation object
;;; start-point start point of leader
;;; end point end point of leader
;;;    Call sample:
;;; (_kpblc-draw-leader "This is test for foolish function!" (setq start-pt
;;; (getpoint)) (getpoint
;;; start-pt))

(defun _kpblc-draw-leader (mtext-string start-point   end-point
   / lead_obj      ann_obj
   )
  ;; Now create leader object
  (setq ann_obj (vla-addmtext
   (_kpblc-get-active-space-obj)
   (vlax-3d-point end-point)
   0
   ;; Width is 0 to get really horizontal line under mtext
   mtext-string
   ) ;_ end of vla-addmtext
lead_obj (vla-addleader
   (_kpblc-get-active-space-obj)
   (_kpblc-conv-pointlist-to-variant
     (apply 'append (list start-point end-point))
     ) ;_ end of _kpblc-conv-pointlist-to-variant
   ann_obj
   aclinewitharrow
   ) ;_ end of vla-AddLeader
) ;_ end of setq
  ;; Change settings of created annotation
  (vla-put-height ann_obj (* 2.5 (getvar "dimscale")))
  (vla-put-attachmentpoint
    ann_obj
    (if (> (car end-point) (car start-point))
      acattachmentpointbottomleft
      acattachmentpointbottomright
      ) ;_ end of if
    ) ;_ end of vla-put-AttachmentPoint
  (vla-put-insertionpoint ann_obj (vlax-3d-point end-point))
  (vla-put-verticaltextposition lead_obj acabove)
  (vla-put-coordinate lead_obj 1 (vlax-3d-point end-point))
  lead_obj
  ) ;_ end of defun

(defun _kpblc-get-active-space-obj ()
  (if (and (zerop (vla-get-activespace *kpblc-activedoc*))
   (= :vlax-false (vla-get-mspace *kpblc-activedoc*))
   ) ;_ end of and
    (vla-get-paperspace *kpblc-activedoc*)
    (vla-get-modelspace *kpblc-activedoc*)
    ) ;_ end of if
  ) ;_ end of defun

(defun _kpblc-conv-pointlist-to-variant (point-list /)
  (vlax-make-variant
    (vlax-safearray-fill
      (vlax-make-safearray
vlax-vbdouble
(cons 0 (1- (length point-list)))
) ;_ end of vlax-make-safearray
      point-list
      ) ;_ end of vlax-safearray-fill
    ) ;_ end of vlax-make-variant
  ) ;_ end of defun
Sorry for my English.

andy_lee

  • Newt
  • Posts: 147
Re: \" symbol string..
« Reply #9 on: December 05, 2016, 05:53:20 AM »
Hi guys
We know : _.qleader ------Set   (can set type to TOLERANCE )

I want use lisp to do this
Code: [Select]
(setq DICEN (namedobjdict))
(if (dictsearch DICEN "AcadDim")
(dictremove DICEN "AcadDim")
)
(dictadd DICEN
"AcadDim"
(entmakex
'(
(0 . "XRECORD")
(100 . "AcDbXrecord")
(280 . 1)
(90 . 990106)
(3 . "")
(60 . 2)
(61 . 0)
(62 . 1)
(63 . 1)
(64 . 0)
(65 . 0)
(66 . 0)
(67 . 3)
(68 . 1)
(69 . 0)
(70 . 0)
(71 . 0)
(72 . 0)
(40 . 0.0)
(170 . 2)
)
)
)

in AUTOCAD2015 , it's ok
But I use it  in AUTOCAD2013 Electrical  , Can't change the type , WHY ?
andy.
Best regards.

tombu

  • Bull Frog
  • Posts: 289
  • ByLayer=>Not0
Re: \" symbol string..
« Reply #10 on: December 10, 2016, 02:39:08 PM »
I've always used Frank Whaley's qlset.lsp  https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/qleader-variables/td-p/814034

It's well documented and he worked for AutoDesk when he posted it so it's kind of the official lisp for doing this.
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D