AutoCAD Visual LISP / AutoLISP :: Create Materials In 2007 - 2008

Jul 17, 2007

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)

[code]....

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)

[code]....

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.

View 1 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Recording Macro Or Series Of Operations In 2007

Oct 19, 2012

Any easy way to create a macro or record a series of commands in 2007?  It's my understanding that 2009 has this feature "built in". 

I want to "record" a short series of commands/actions to use as a example to other novice users at my company.

It should be something that they can "run" and watch on their screen. (like trim a circle to get a arc)

I have downloaded/tried several general screen recorders but the resulting file is way too big. (20MB AVI)

I would prefer a Macro that would run right in Autocad.  Maybe a third party plugin is available?

I am not looking to create a traditional Macro to use as a time saving device.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create A Shortcut Key ( TAB )

Jun 15, 2012

I want to create a shortcut key (like TAB) for example and whenever I start a polyline or move or whatever, I can hit TAB which will grab the angle my cursor is at, and then use the angle lock to lock the cmd into that direction. (This is essentially what can be done in rhino if you are familiar with this). 

The manual way in autocad is typing it ("<45") but I just want to calculate angle from the start point to cursor point. and then once hitting tab or a key or a new command, it will lock with that angle. How can I go about programming this.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create TXT File

Apr 3, 2012

Looking for example of a lisp file that take the value of a variable and create a txt file on a specific place defining by the user, with 10 lines in each one of them begins with what is in the variable, followed by a text already done.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Plot A0 Or A0+ Onto Several A3?

Mar 20, 2013

Is it possible to create a lips that does the following:

- In the Modelspace

- Get 2 points to create a plot window / give two points. (get point 1, get point 2, list points)

- Divide the window into A3 size windows

- plot scale 1:100 / prompts to ask

- Plot / Print the A3 size windows with the given / preset configuration(s)

- Perhaps even add a number to each page.

In other words, Plot / Print a A2, A1, A0 or bigger onto several A3 pages.

Depending on how big the page is, number of A3 pages, plotscale 1:100

Or asks what plot scale I want to use.The only thing I think I will need is something like:

Get point 1, get point 2, List the points. So I can set the window.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create VLX File

Aug 6, 2013

how can i create single " .vlx" file from my lisp and dcl files?  how to convert my lisp to vlx ?

i have to collect my all lisp into the single .lsp file and than convert to .vlx? if it is gonna be like that how about dcl file ?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create New ARG File

Jul 18, 2012

How to create a new .ARG file

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create Custom Controls

Apr 17, 2012

I want my application to include a useful Ribbon interface that displays custom properties, read from my custom objects.

I have found the existing Ribbon Control Elements, but I want to use custom controls, not the pre-canned controls.

Is there a generic programmable input box for the AutoCAD Ribbon?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create A Hatch Pattern

Jul 16, 2012

I'm trying to create a hatch pattern to match a floor tile. I want a 24" long x 6" wide plank tile.  The tiles should be offset from each other 8" (a 2/3 1/3 pattern lengthwise).  My problem is I only can get a 6" offset (3/4 1/4 pattern).Here's the code I've got:

0, 0,0, 0,6
90, 0,0, 6,6, 6,-18

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Linestyle With Text?

Apr 13, 2012

I would like to know how i can create a linestyle with text using lisp?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Many Lines With Its Data

May 28, 2012

I want to make many object cooper lines in autocad and each line has some data about its length, size, type etc.  that can then extract to excel as a Bill of materials. 

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create Pline In Modelspace

Feb 15, 2013

I have been using one routine very successfully to create a pline in modelspace that has the outline of the chosen viewports in the drawing. This one works great.

Now I am trying add other routines that I've done to better fit my needs. If I use each routine individually at the command line they work, but when I use all in a single command I got the following errors:

The routine SetColor - does not change color to Bylayer The routine RectWidth - ; error: bad SSGET list

Why?

See the attached file for more details and be free to improve whatever you want in my routines because they are very basic.

And, if I am not asking to much, is that possible to not be prompt to select objects? I mean, the routine could automatically select all viewports in the drawing...

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create A Self-installing Package

Apr 1, 2013

until now I've always used ACADINST.exe to realize my self-installing setup packages for my application lisp: [URL]

Now there AutoCAD2014 which introduced some variables that affect proper operation completely automatic: TRUSTEDPATHS and SECURELOAD.

Is there a way to add search paths, modify variables, load menu, set the automatic start of a *.Lsp or *.Fas, during installation of the application, without opening AutoCAD?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Blocks And Name Them In Sequence?

Jul 13, 2012

i have created an Autolisp routine that creates a drawing made up of structural members, x-refs & surfaces based on a few different user inputs. I now want the program to insert the drawing as a block rather than individual elements. My Idea was simply to use the block command in the lisp routine to create a block and then have the drawing create itself in block editor, and close once it has done. however I am having difficulty thinking of a way that I can get AutoCAD to automatically name this block depending on other blocks in the drawing, i.e. in sequence. The name is irrelevent really, but it would make sence for it to be logical, so... if the last block inserted was "b7" then the next one should be "b8" and so on.

Is there a better way of doing it all together? I have read a bit into "entmake" but i'm not sure on how to use that function.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create Macros Of A Drawing

Aug 6, 2012

How to create macros of a drawing and then hw can we change the drawing by editing the macro. E.g.. I have drawn a circle of 30 mm dia.. than need to crate macros for same and then by changing the dia of circle in macros I want to create new circle of 50 mm dia.

Another thing I wanted to ask is what is difference between visual lisp and visual basic. Which is easier??

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create Arc Polyline With Entmake

Jan 4, 2013

I have run into a little trouble in trying to figure out how to create a arc polyline with entmake. I've put together the following and it works great with command "pline". I just want to know how to do it with entmake.

(defun C:22 ()
(setq P1 (getpoint "
Specify first point: ")
P2 (getpoint P1 "
Specify next point: "))
[code].......  

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create Some Plines In A Drawing

Sep 10, 2013

I have to create some plines in a drawing from the inputs provided by the client. I prepared a lisp code for it. I have to use it to 1000 drawings. Every time I open the drawing and running the lisp command.

Is any lisp code to run in bulk open drawings with out entering command prompt.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Block - Add Attributes Automatically

Nov 3, 2013

How I can modify this code to create a block, ask for a new name for the block, then add the attributes listed inside the code below to the new created block. The lisp does a wonderful job - however, it only works if you already have a block created. We are in the process of drawing components and making blocks one by one, so it makes sense to add the attributes automatically when the block is created. We currently have over 500 components to create as a block and set the attributes to each one by one. 

Also I would like to know, If Fields can be used inside the lisp routine. That way we can always have access to the attributes from outside the block and change values for all the blocks at once.

(defun c:addattribs ( / blk def ) (while (not (or (= "" (setq blk (getstring t "
Name of block to update: "))) (tblsearch "BLOCK" blk) ) ) (princ (strcat "
Block "" blk "" not found.")) ) (if (/= "" blk) (progn (setq def (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) blk)) (vla-addattribute def (getvar 'textsize) acattributemodelockposition "New Attribute 1" (vlax-3D-point 0 0) "NEW_TAG1" "New Value 1" ) (vla-addattribute def (getvar 'textsize) acattributemodelockposition "New Attribute 2" (vlax-3D-point 0 (- (* 1.5 (getvar 'textsize)))) "NEW_TAG2" "New Value 2" ) (command "_.attsync" "_N" blk) ) ) (princ))(vl-load-com) (princ) 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create A Pop Up Menu Triggered By A Function Key?

Dec 29, 2011

I would like a small menu to pop up near the cursor like the middle mouse button menu, but based on some other function key or quick key shortcut. 

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: File That Create Layout For Each Layer?

Apr 13, 2013

Lisp file that create a layout for each layer,I’m looking for a lisp file that creates layout for each layer instead of doing this manually.

Software: AutoCAD 2014, AutoCAD C3D, AutoCAD M3D, Revit
Windows 7 (Ultimate 64 bits),
Firefox 20.0,
Kaspersky 2013.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create Layer Name In Attributes String Value

Oct 15, 2013

How i can filter attributes string value.

How i set the layer name is = attributes string value.

Example:

A attributes string value is R8 .all these string is set the layer name is same string value(R8).

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create AddLightWeightPolyline From Vlax-3D-point?

Jan 17, 2012

create addLightWeightPolyline with 4 points above:

;    pktaSpocznik01Lg pktaSpocznik01Ld pktaSpocznik01Pg pktaSpocznik01Pd
(defun dtr (x) (* pi (/ x 180.0)))  ;define degrees to radians function
(setq dokladnosc 3) (setq odScianaVerg 200)  (setq odScianaVerd 150)
(setq odHtextOr01 2.5) (setq odHtextOr02 3.5) (setq odHtextOr03 5)
(setq odWmPrzekroj01 500) (setq odWmPrzekroj02 700) (setq odWmPrzekroj03 1000)
(setq OdwrOverallScale 0.1) (setq odWmExLine01t 50)
(setq odSciana01gr 250)  (setq odSciana02gr 250)

[code]...

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Sub Areas From Intersecting Polylines

Oct 17, 2011

Essentially, I'll be creating a sort of Venn diagram.  So for the purposes of this exercise, let's assume it's the classic Venn diagram of three intersecting circles.  But I need this to work with closed polylines, that may also have arc segments in them.

Anyway, so I have these intersecting areas, and I need to create bounding polylines for each area, and assess the number of overlaps.  So, as in a Venn diagram, the areas where only one circle is present can then get shaded one color, areas where two circles are overlapping can get a different color, and the area where all three circles overlap can get a third color.

I'm clearly going to have to be converting the various boundaries to Regions, and performing some Unions.  It seems I could grab all objects, convert them to Regions 2 at a time, and compare their Union'ed area to their individual area, to determine if they overlapped at all.  With only the 3 cirlces, that would work, but when I have 35 individual polyline areas with arcs, suddenly this method feels like it will break down.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Layer By Xrefs And Blocks?

Nov 15, 2013

who can share with me a lisp which can create layer by xrefs and blocks ( if this can be an optional , would be nice ) ?

even maybe lisp can create layer group filter with "XREF" group name and move layers to inside.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create A Line With Text Offset

May 6, 2013

I am a beginner at LISP and this is a bit out of my league... and I'm trying to create a lisp where I can draw a polyline between 2 points that also places text with the actual distance offset above the line.

I did find this post and I'm not quite catching on.. [URL] ......

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create A Custom Block With Attribute

Mar 16, 2012

i'm relatively new to lisp routines. I've been trying to create a routine that will create a custom block with attribute with an option to select which drawing border size is being used. This is what i've got so far;

(defun c:NEW_REV_NOTE ()
(PRINC "
Drawing Size:")
(SETQ Paper_Size (GETSTRING "
[A1/A3] <A1>: "))
(IF (= Paper_Size "A1")
   [code]....

I'm going wrong at the moment I get an error message when I try to load the file "; error: syntax error".

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create Princ That Displays Variables Value

Jan 11, 2012

I have a custom variable id like to have displayed in my princ section I have the following however it keeps returning ; error: bad argument type: file 
 
(princ MYVAR " file found..."))

How  can I fix this?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Layouts In Multiple Drawings

Aug 10, 2013

I have a csv file that has the drawing names and their layout names listed in columns A and B. Before I begin a project, I have to create the Sheet List (in Excel) and the csv file. The csv file is needed because I have a lisp routine that reads the csv and updates all my Title Block attributes in all my drawings. (VERY sweet program)  What I'm wanting to do, is create new layouts (using my dwt) based on the information in the csv file. So, when I start a new project all I need to do is create the base drawing files first. Then, in my csv file I've got those drawing names listed in Column A and their corresponding sheet titles (Layout names) in Column B. I run the lisp and it reads the csv and creates layouts in all those base drawings and naming the layouts with the sheet titles from column B.

Column A                                                      Column B
DRAWINGS                                                 SHEET TITLES
drawing1.dwg                                               A100
drawing1.dwg                                               A101
drawing"n".dwg                                            "n"500
Etc, etc.

I'm needing a way to automate creating hundreds of layouts at once. (very time consuming).So the lisp has to be able to read a csv (or Excel--doesn't really matter) and create new layouts (using my dwt) in as many drawing files represented in column A. [and filtered so it doesn't create duplicates so I can run the routine at a later date when new sheets are added to the drawings] Captcha?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create Linetype With Double Lines

Aug 12, 2012

I want to know how to create linetype with double lines one rectangle empty and other with solid in autocad(i am using autocad 2004)I tried by express tools with command mkshape (and then makelinetype command) but it is coming without solid, is it possible in autocad by using Autolisp, see attached dwg, name is linetype_ds

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create A Selection Set Of Y Values Of Text?

May 9, 2013

What I am trying to do is create a selection set of the "y" values of text.  I've started by pulling out all the text on the drawing, but I need it to continue to grab only the "y" values of the text on the drawing.

(setq alltext (ssget "_x"  (list '(0 . "TEXT")) 
)  
)     

I've tried a bunch of different things but I am still new to lisp.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create ONLY Custom Shortcut During Deployment?

May 28, 2013

I'm creating a deployment for AutoCAD 2014.

At the end of the deploy process I'd like to end up with a custom AutoCAD shortcut on the desktop that calls an ARG file.  This is no problem.

The problem is that to get that shortcut I need to check the "create desktop shortcut" check box and then I wind up with 2 shortcuts on the desktop, the default "AutoCAD 2014 - English" and my custom shortcut.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved