Grootte: 2864
Commentaar:
|
Grootte: 2907
Commentaar:
|
Verwijderingen worden op deze manier gemarkeerd. | Toevoegingen worden op deze manier gemarkeerd. |
Regel 3: | Regel 3: |
<<TableOfContents()>> ---- |
|
Regel 4: | Regel 7: |
Regel 8: | Regel 10: |
Regel 9: | Regel 12: |
(setq ss (vlax-get-acad-object))}}} | (setq ss (vlax-get-acad-object)) }}} |
Regel 11: | Regel 15: |
Regel 12: | Regel 17: |
(vlax-dump-object ss)}}} | (vlax-dump-object ss) }}} |
Regel 14: | Regel 20: |
Regel 16: | Regel 23: |
(vlax-dump-object ss)}}} | (vlax-dump-object ss) |
Regel 22: | Regel 29: |
(vlax-dump-object ss)}}} | (vlax-dump-object ss) |
Regel 24: | Regel 31: |
Regel 32: | Regel 38: |
(vla-get-printerstylesheetpath ss)}}} |
(vla-get-printerstylesheetpath ss) }}} |
Regel 39: | Regel 45: |
(vla-put-printerstylesheetpath ss "x:\\cad_users\\19.1\\plotters\\")}}} |
(vla-put-printerstylesheetpath ss "x:\\cad_users\\19.1\\plotters\\plotstyles") }}} |
Regel 48: | Regel 54: |
Regel 52: | Regel 57: |
Regel 65: | Regel 71: |
)}}} | ) }}} |
Developing solutions can be a challenge and on this page notes are maintained - maybe they can help you!
Inhoud
vla-get vla-put
You can control much with this combo. The question is: How to use it? Paste and study on the command line (F2)...
If you paste:
(setq ss (vlax-get-acad-object))
... you get an object - assigned to variable ss. Next you want to know the properties of ss:
(vlax-dump-object ss)
Now you know the properties and one of the entries is preferences. Let's see what it offers, if you paste each line...
(setq ss (vla-get-preferences (vlax-get-acad-object))) (vlax-dump-object ss)
... you get an object files. So the next step:
(setq ss (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) (vlax-dump-object ss)
Now we have all files settings. As long is there is not a (RO) text (Read Only), we can change it.
For example, we have all plotter configurations on a server drive. The current locations are:
(vla-get-printerconfigpath ss) (vla-get-printerdescpath ss) (vla-get-printerstylesheetpath ss)
We assign a different location:
(vla-put-printerconfigpath ss "x:\\cad_users\\19.1\\plotters") (vla-put-printerdescpath ss "x:\\cad_users\\19.1\\plotters\\pmpfiles") (vla-put-printerstylesheetpath ss "x:\\cad_users\\19.1\\plotters\\plotstyles")
Cool?
In summary: You start with (vlax-get-acad-object) for building a selection set, making it complexer as described, where (vlax-dump-object ss) is your friend. If you know the properties by using "get", you can change them with "put".
Easy Peacy!
LISP and groups
How can we handle named and unnamed groups?
If you want to do operations within a group you can use what is documented here: http://adndevblog.typepad.com/autocad/2012/12/how-to-add-a-group-in-a-selection-set-from-an-autolisp-function.html. A cached version:
(defun selgrp (grpname) ;; grpname is the group name, it accepts ;; unnamed groupnames, such as *A1 (setq grp (dictsearch (namedobjdict) "ACAD_GROUP")) (setq a1 (dictsearch (cdr (assoc -1 grp)) grpname)) (setq ss (ssadd)) (while (/= (assoc 340 a1) nil) (setq ent (assoc 340 a1)) (setq ss (ssadd (cdr ent) ss)) (setq a1 (subst (cons 0 "") ent a1)) ) ss )