In AutoCAD 2006 and previous versions when we had to create a new STANDARD material with a pattern/texture map and attach it to a selection set of objects, first of all we had to load render.arx (arxload “render.arx”) and then we had to call the following function:
;;; matname = New Material Name ;;; ss = Selection Set of Objects ;;; Matfile = The name of the jpg file (defun SetMaterial (matname ss matfile / r1) (if (null (member matname (c:rmat "l"))) (if (findfile matfile)
The above function checks if a material with name matname exists and if not then it creates a new STANDARD material with name matname, material color (-1.0 -1.0 -1.0), which means derive the color from an object’s ACI (diffuse color), color-weight factor 0 (the amount of diffuse color) and a pattern/texture which is described in the list (list matfile 1.0 1 nil nil nil 1 1). The following table describes the pattern/texture arguments:
matfile name of the bitmap file 1.0 amount of map color to use 1 tile(repeat the patterns) nil u and v scale factors (AutoCAD used the default values) nil U and V offsets (AutoCAD used the default values) nil (reserved by Autodesk)
It was not necessary to define CreateNewMaterial with all these arguments, but I do it for future purposes.
In the attached file you can see the definition of MaterialExists, CreateNewMaterial and some other functions:
MaterialExists: Checks if a material exists.
DefaultNewMaterial: Default values for new materials. I have used the AutoCAD defaults, but one can modify them accordingly.
CreateNewMaterial: Creates a new material. If one needs more information on the meaning of the arguments I think Ralph Grabowski’s “Tailoring AutoCAD Rendering” is a good start.
AttachMaterialToEntity:Attaches material to objects
MaterialByLayer: Modifies an object to have material by layer.
AttachMaterialToLayer: Attaches material to a layer.
As you can see I don’t use vlax functions, because I write the code for OEM programming purposes. You can change the functions accordingly.
I use Spell Check regularly and I always check the entire drawing. I would like to add to the Spell macro so that when I pick Spell from the toolbar it goes past the Check Spelling window and begins checking the entire drawing.
I believe I need to insert Alt S into my macro to select Start from the window to begin the check. Is there a character or series of characters that will represent Alt in a macro?
I used to have a short, one-line macro in my MNL file that would read the location of the currently active drawing, find the parent directory of that drawing (truncated to 3 levels) and open a Word document in that directory that is named after the project.
I have tried to find information about this, but I am having a hard time. So i need to explain what I am doing.
I would like to be able to use commands stored in the cui menu file, initially this is done using our tablets, but our tablet drivers cannot work with windows 7 and autocad, nor can i get any that do, (i have tried over 20 different drivers).
So, instead of making a lisp function for every macro. I need to be able to use some of them.
Can I execute one of these macros using "MENUCMD" ? , I have all the information i need to do it but cannot figure it out menucmd does not seem to have an option to actually run the macro, and if it does It only seems to be able to do that with popup menus.
Currently i use the ribbon and add them in there, but want to know If i can do so just with lisp. and create my own on-screen tablet menu.
Here is an example of one of the macro's in the cui i need to use.
I would like to use the following macro from the LDD 2004 Civil menu (yes, we are still using 2004!): ^C^C^C^P(cd_mnl)(zz_sdsk '(ad_xsutl 2));LDD. The macro is Zoom to Station from the Cross Section pulldown menu. How to use this in a LISP routine, or an equivalent LISP command? (The user won't be supplying the station number. The station number will be extracted from a selection set of objects with attribute blocks with equivalent station numbers.)
Each cross section has an attribute block associated with it, which lists all the details for that section, including station. The macro must be using that block (listed in a database, perhaps?) to find the station in the dwg.
However now the block retains its layer properties ......ie E-Lighting-Ceil (or what ever I name it) but it drops the block
in RED, instead of its original colour.
Question is Im looking for a macro that will bring in my block as per ^c^c-insert;HVLV-UB610x125;;;;
but also bring it in to a drawing on its original layer that its saved to.
please note that even thou the first code brings it in at layer 0, the blocks layer is also inserted into the DWG however its just not associated to it ..... hence the user has to select the block once he or she has brought it in and then change the layer from the layers manager manually. This is not ideal.
just to recap i just need a macro that will A) bring in a block from a location. And B) keep all the properties it has when it is brought in.
It's been too long since I created one of these for Toolbars. I need a macro that will insert and explode a block. I just need the block's content, not the block itself. I can create a maco to explode a block with no path, but can't remember how to include the "*" in a file with a folder path to explode the block while its being inserted. Because of spaces in the file name, quotes (") must be around the path.
I'd like to change a layer's color from command line because of a user icon. I figured out from previous topics that I should use macro similar to this: ^C^C_filedia;0;-la;s;Verdeckt (ISO);c;1;l;dashed;;_filedia;1;re;
(I want to use this macro to change layer's linetype, too, but that's not the point)
The only problem with this macro: layer's name contains a space therefore Autocad tries to recognize Verdeckt as a command (and macro interrupts there) instead of setting Verdeckt (ISO) as the current layer. I've tried using different quote marks, none of them worked (' and " and <>). I hope there's a method for entering a parameter that contains space.
Software: Inventor Series 2011 SP1 x64 OS: Vista Business x64 CPU: E6400 RAM: 2*2Gb GeIL VGA: Quadro FX 550
I have a list ("temp.dwg" "temp2.dwg") and would like to add the string "insert text here" into each item in the list resulting in ("insert text heretemp.dwg" "insert textheretemp2.dwg"). how would i go about doing that using LISP?
Is there a way to programatically set a visual style before a drawing actually opens?
We have some huge models and people seem to forget to change their visual styles back to 2D wireframe before saving and exiting drawings. Some models will crash on some workstations when trying to open in a rendered mode.
I found a lisp with a function that looked to set viewport visual styles. But it does not seem to be supported anymore. --> (vla-put-VisualStyle vport 1)
Is it possible to execute a certain command based on multiple selections withinin a dcl? for example: two radio colums, one with selections A and B, and a second with selections 1 and 2. is it possible to program commands based on user selections from each column? ex: if A and 1- do a command. A 2- do a different command, etc...
I tried :
(action_tile "key1" "(setq A t") (action_tile "key2" "(setq B t")
I am trying to find a lisp that would get an attribute value (tag name = NBR_5) . I'm trying to run a simple routine that would let the user place the value from the titleblock attribute as text on a drawing. I see a ton of articles regarding getting attributes but I am not well versed in programming.
I'm trying to find acceptable point values to feed to the vlax-3d-point function for a vla-addmtext function. With vanilla lisp I just provide the point as x y = "7/32" "2-3/8". So I assumed that I could drop a 0 in for the z like: (VLAX-3D-POINT "7/32" "2-3/8" 0).
Then I thought I was going to be tricksy and try (vlax-3D-point (getpoint)) believing that I could pick the point and get what I need to feed the function, but yet again, no deal. The command line gave me:
node of #<variant 8197 ...>
Nothing I can use in my code. So how do I find the point in a format that vlax-3d-point will like?