Zykl0 Posted June 1, 2011 Posted June 1, 2011 Hello, I found a script i would like to use but i have no idea how to run it, and i cannot find anything on the internet. The script look like Sub AllLayersToByLayer() Dim color As AcadAcCmColor Dim obj As AcadEntity Set color = New AcadAcCmColor With color .ColorMethod = acColorMethodByACI .ColorIndex = "256" End With For Each obj In ThisDrawing.ModelSpace obj.TrueColor = color Next obj End Sub My questions are: What is this language? how do i load this into autocad? how do i execute this into a lisp file? Please i need someone to explain me and assume i know close to nothing about programmation Quote
Lee Mac Posted June 1, 2011 Posted June 1, 2011 Looks like VBA to me. Is the SETBYLAYER command available to you? Quote
rkmcswain Posted June 1, 2011 Posted June 1, 2011 This is VBA, and not autolisp. If you know nothing about VBA, then loading this is not trivial. Start here for more info: http://www.afralisp.net/visual-basic-for-applications/ This is a simple routine that could be written in lisp fairly easily, and it is a built in command in recent versions of AutoCAD. (Command: SETBYLAYER - available in R2008 and later) Quote
Lee Mac Posted June 1, 2011 Posted June 1, 2011 Translation of your VBA to LISP: (defun c:test nil (vl-load-com) (vlax-for object (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) (vla-put-color object acbylayer) ) (princ) ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.