vba for attaching material(bmp,jpeg) to layer in autocad
Can anyone help me to code in vba for attaching material(bmp,jpeg) to layer in autocadand render on click of a button.Its urgent.what do you have so far?
Hey Sham
I have done these things manually but never automated the process
I agree with CM, cna you show us what you've done so far?
Couldn't stay away, member formerly known as ML?
- EDIT -
removed first person reference by member request
- EDIT -
left first person reference out for now but regained at least some of the intent of my post
And what was the intent Bob?
My intent is to advance my CAD skills and try to help others as much as I can.
I don't hang onto animosity.
In the future, please feel free to pvt me anytime,as opposed to placing none CAD related matter (such as my first name) in the post.
Thank you
Zep I wasn't aware that calling someone by name equaled animosity.You can read that on whatever your next account is. this is what i have it work fine in autcad2007 but in 2005 some problem
(defun c:pumat(/ Lst sSet mLst cMat sCnt lCnt mCnt eCnt)
(vl-load-com)
(setq Lst (list
'("0" "Global")
'("Layer1" "Material 2")
); 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>>"))
); end progn
(princ "\n No Solids Found")
); end if
(princ)
); end of c:pumat I take it you gave up on using vba wel stil looking for vba version of the code. to attach material to layer for autcad2005 Help me out guys to attachmaterial to layer in autocad2005/2006 with vba or lisp program..badly needed.
页:
[1]
2