Author Topic: VLA-GET-MATERIALS how to incluse this missing componet in autocad 2005 for lisp  (Read 4244 times)

0 Members and 1 Guest are viewing this topic.

shamsam1

  • Guest
this two methods are missing in autocad2005. Is there any website where
we can download are any steps to include this two component


to check if VLA-GET-MATERIALS is there in autocad Steps to follow

Step 1: Command: (vl-load-com)
Step 2: Command: (vlax-dump-object(vla-get-ActiveDocument(vlax-get-acad-object))t)

Materials (RO) = #<VLA-OBJECT IAcadMaterials 0fa4f884>
ActiveMaterial = #<VLA-OBJECT IAcadMaterial 0fa362b4>
« Last Edit: August 06, 2008, 08:09:48 AM by shamsam1 »

jbuzbee

  • Swamp Rat
  • Posts: 851
just a guess:

Code: [Select]
(vlax-get acadobject 'materials)
(vlax-get acadobject 'activematerial
James Buzbee
Windows 8

shamsam1

  • Guest
wel still its gives the error in lisp program

this is smple program which i am using to attach material to layer.it work fine in autocad 2007 but in 2005 its shows error : no function definition: VLA-GET-MATERIALS



(defun c:pumat(/ Lst sSet mLst cMat sCnt lCnt mCnt eCnt)

(vl-load-com)
 
  (setq Lst (list
          '("0" "Global")      

'("Layer1" "material1")
      
        ); end list
            ); end setq

  (vl-load-com)
 
(if(setq sSet(ssget "_X" '((0 . "*SOLID"))))
  (progn
    (setq sCnt 0 lCnt 0)
    (vlax-for mat (vla-get-Materials
              (vla-get-ActiveDocument
           (vlax-get-acad-object)))
      (setq mLst(cons(vla-get-Name mat)mLst))
      ); end vlax-for
    (foreach itm
        (mapcar 'vlax-ename->vla-object
          (vl-remove-if 'listp
            (mapcar 'cadr(ssnamex sSet))))
         (if(setq cMat
         (cadr
           (assoc
             (setq cLay(vla-get-Layer itm))Lst)))
      (if(member cMat mLst)
        (if(vl-catch-all-error-p
             (vl-catch-all-apply 'vla-put-Material
          (list itm cMat)))
          (setq lCnt(1+ lCnt))
          (setq sCnt(1+ sCnt))
          ); end if
        (if(not(member cMat mCnt))
         (setq mCnt(cons cMat mCnt))
          ); end if
        ); end if
      (if(not(member cLay eCnt))
        (setq eCnt(cons cLay eCnt))
        ); end if
          );end if
       ); end foreach
    (if(or(/= 0 lCnt)(/= 0(length mCnt))(/= 0(length eCnt)))
      (progn
   (princ "\n========================= ERROR LIST =========================\n")
   (if(/= 0(length mCnt))
     (progn
       (princ "\nFollowing materials missed in drawing: \n")
       (foreach mat mCnt
         (princ(strcat "\n " mat))
         ); end foreach
       (princ "\n")
       ); end progn
     ); end if
       (if(/= 0(length eCnt))
     (progn
       (princ "\nSome solid layers missed in list: \n")
       (foreach lay eCnt
         (princ(strcat "\n " lay))
         ); end foreach
       (princ "\n")
       ); end progn
     ); end if
    (if(/= 0 lCnt)
      (princ(strcat "\n" (itoa lCnt) " were on locked layer!\n"))
     ); end if
   (princ "\n========================== END LIST ==========================\n")
   (textscr)
   ); end progn
      ); end if
         (princ(strcat "\n<<< Materials are appropriated for "
            (itoa sCnt) " of "
            (itoa(sslength sSet)) " solids >>>"))
    ); end progn
  (princ "\n<!> No Solids Found <!> ")
  ); end if
  (princ)
  ); end of c:pumat

shamsam1

  • Guest
Still problem not solved :-( for autcad2005