Verschillen voor "Developing"

Verschillen tussen versies 5 en 6
Versie 5 sinds 2016-12-04 11:15:31
Grootte: 2864
Commentaar:
Versie 6 sinds 2016-12-04 11:16:29
Grootte: 2856
Commentaar:
Verwijderingen worden op deze manier gemarkeerd. Toevoegingen worden op deze manier gemarkeerd.
Regel 17: Regel 17:
}}}
Regel 23: Regel 23:
}}}

Developing solutions can be a challenge and on this page notes are maintained - maybe they can help you!

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\\")

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
)

This site is hosted by NedCAD.

De inhoud van deze site wordt aangeboden zoals het is, zonder enige vorm van garantie en heeft verschillende licenties. Meer informatie over licenties staat hier.