AutoCAD Visual LISP / AutoLISP :: Write Routine That Will Make Layer Called Hatch

Aug 1, 2012

I am trying to write a lisp routine that will make a layer called hatch, set it as current and then run the hatch command.

BUT the hatch command is not bring up the hatch dialogue box, it just puts things on the command line.

The layer is being made & set current.

The lisp is as follows:

(defun c:hh (/ ec)
(setq ec (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "-layer" "m" "hatch" "c" "8" "" "l" "continuous" "" "s" "hatch" "")
(command "hatch")
(setvar "cmdecho" ec)
)

On another matter, I have just found the bevel lisp routine by Terry Miller which works great BUT only for imperial measurements. How to make Terry's metric, that will work for metric measurements.

View 6 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Make On Screen Layer Picker Routine?

Dec 16, 2011

I would like to make an on screen layer picker routine that sits in the upper left corner of the screen and always stays there.

I currently have a list of layers printed out in the drawing that I can do a "select current layer by pick" but they are always getting in the way as they are part of the drawing. 

I would mind if the pallette was part of the drawing if it could "float" and always stay in the upper left corner somehow.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Write A Lisp Routine That Invoke The Mleader Command

Oct 11, 2012

I'm trying to write a lisp routine that, when I invoke the mleader command, osmode is set to "nearest" & orthomode is set off. I then would like the original settings to be returned.

attached is what I have written so far:-

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Change Layer Color

May 21, 2003

I am looking for a lisp routine to search the layer table to find a particular layer color and change color.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Change Layer State Names

Nov 2, 2011

I have 2000+ drawings that have either the layer state "LMAN_DWF" or "DWF".  I want all of them to read "DWF" for scripting purposes. LSIP routine that will go into a drawing and change rename a layerstate if it is named incorreclty, but do nothing if it is named correctly?

Does Layer State "DWF" exist?

If Yes, skip file and move on to next file

If No, does Layer State "LMAN_DWF" exist?

if Yes Rename Layer State to "DWF"

If No, skip file and move to next file.

Or a LSIP routine that can simply dump a list of all drawings in a directory that contain "LMAN_DWF" as a layer state.  I could then use that list to do a simple script to change the layer state names on those specific files.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Change All Hatch To Particular Layer

Nov 7, 2013

Lisp that can select all hatch in a drawing with a layer called AELE, even if it is embedded in a block and change it to layer AHAT with Green colour?

The layer AHAT may or may not already exist in the drawing.

We need to run the lisp on a lot of drawings (exported from Revit) so I need to use the script to run this lisp on multiple drawings.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Entmake A Hatch Entity From A Hatch Template?

May 2, 2013

I am trying to entmake a hatch entity from a hatch template.

After entget the template hatch entity, i get the followings

Select object: ((-1 . <Entity name: 7ed11b78>) (0 . "HATCH") (330 . <Entity
name: 7efc7c10>) (5 . "737") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
"SECTION-LABEL") (62 . 255) (100 . "AcDbHatch") (10 0.0 0.0 0.0) (210 0.0 0.0
1.0) (2 . "SOLID") (70 . 1) (71 . 0) (91 . 1) (92 . 1) (93 . 8) (72 . 1) (10
633596.0 5.79713e+006 0.0) (11 633519.0 5.79713e+006 0.0) (72 . 1) (10 633519.0
5.79713e+006 0.0) (11 633519.0 5.79708e+006 0.0) (72 . 1) (10 633519.0
5.79708e+006 0.0) (11 633500.0 5.79708e+006 0.0) (72 . 1) (10 633500.0

[code]....

Now I  wrote the following code using the above data as follows

(entmake (list (cons 0 "HATCH") (cons 67 0) (cons 410 "Model") (cons 8 "SECTION-LABEL") (cons 62 255) (cons 10 (list 0.0 0.0 0.0)) (cons 210 (list 0.0 0.0 1.0)) (cons 2 "SOLID") (cons 70 1) (cons 71 0) (cons 91 1) (cons 92 1) (cons 93 8) (cons 72 1) (cons 10 pt1) (cons 11 pt2) (cons 72 1) (cons 10 pt2) (cons 11 pt3) (cons 72 1) (cons 10 pt3) (cons 11 pt4) (cons 72 1) (cons 10 pt4) (cons 11 pt5) (cons 72 1) (cons 10 pt5) (cons 11 pt6) (cons 72 1) (cons 10 pt6) (cons 11 pt7) (cons 72 1) (cons 10 pt7) (cons 11 pt8) (cons 72 1) (cons 10 pt8) (cons 11 pt1) (cons 97 0) (cons 75 0) (cons 76 1) (cons 98 1) (cons 10 (list 0.0 0.0 0.0)) (cons 450 0) (cons 451 0) (cons 460 0.0) (cons 461 0.0) (cons 452 1) (cons 462 1.0) (cons 453 2) (cons 463 0.0) (cons 63 5) (cons 421 255) (cons 463 1.0) (cons 63 7) (cons 470 "LINEAR")))

The point variables pt1, pt2....pt8 are all defined. But when I run the code the hatch is not being created? Why?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Automatically Pick Up All Hatch And Solid Hatch Patterns

Aug 6, 2008

I am in need of a lisp routine which will automatically pick up all hatch and solid hatch patterns within a drawing and change the colour to colour 254.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Stuck In A Routine 2?

Nov 21, 2013

Basically, the routine asks for the user to choose the hatch type (Retirer/Percer), then the layer (Defpoints/Select/Current) and finaly the type of the object to draw (Polyline/Rectangle). My original routine has also a Circle and a Boundary options, and an Error trap to reset the variables but I will keep it simple for the purpose of my issue. 

So, my issue is: when I choose the type of object to draw, it draws just one of it and the routine ends. I would like to have something that "says" to the routine that I want to keep drawing that object (Polyline or Rectangle) and putting the hacth inside until I do enter and then the routine goes to its end.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Force A Routine To Be Run

Dec 10, 2012

I have created an acad.lsp file in where I want to arrange all our company settings. I've stored it on the network to make sure everyone will use the same one and when updates take place I don't have to run past all pc's to change it. I've set everything in the deployment package but users can still change it when they reset their profile. Plus some pc's are already installed with AutoCAD before creating the lisp routine, how can I enforce the support directory to check on the network for the acad.lsp each time?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Use Selection Set For Routine?

Oct 16, 2013

with the mouse I can select objects on the screen and then start a command that uses these objects.

How can I perform this in lisp?

I can create my selection set, that's no problem, but how can I 'make it active'  for an external function?

(ssget "_C" p0 p1 '((0 . "TEXT")))
???
(c:txtexp)

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Check Overlap

Aug 12, 2012

I want autolisp program to check overlap like in closed or open polyline with any other entity in the drawing, whether other entity is overlapping inside the polyline or not, i am beginner in autolisp and want to know exactly which functions are used or the program itself Also if possible to check circular overlap of one polyline with itself.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine For Rotating Lines

Jul 23, 2013

LISP routine for rotating lines so that text in linetypes always reads from left to right?

I use the QUERY command to create basemaps and often the lines that are imported read upside down or backwards or however you prefer to look at it.  Most often, if I look at the XY coords of these backwards lines, the End X coordinate is of a higher value than the Start X coordinate.

Looking for something that would compare the two X coordinates of a line, do some sort of an IF Start X > End X, and if its true, store the XYZ coords of the Start and End in some variable, and swap them.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Replace All Blocks

Oct 5, 2011

I am looking for a routine that will replace all blocks named "DgnMisc_nodepoleind" with a block named "DgnMisc_nodepoleind2" keeping the insertion point. I could use (command "-insert" "DgnMisc_nodepoleind=Y:/ACAD2007/DA settings/Library_new_scale1/DgnMisc_nodepoleind2.dwg" NIL ) but my problem is that the block I want to replace is used on two different layers and I only want to replace the ones on layer "TPSYM01".

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine For Page Setup

Jan 9, 2013

I found a lisp routine on the internet to change page setups on multiple layouts. The lisp worked but on some of the layouts it moved the viewport off the paper background (see attached). The layouts print fine but the only way to get the viewport back on to the background is to open the page setup and click modify, then ok and close. I tested this on a .dwg that I had saved to my computer rather than on one in  the main folder but I would like to do this to to all are maps since our IT decided to rename our printer and now all pages setups are no good.All I know about lisp is how to run one.

;; Copy current layout page setup to all layout tabs
(vl-load-com)
(defun c:CPS (/ Adoc Layts clyt)
  (setq aDoc  (vla-get-activedocument (vlax-get-acad-object))
 Layts (vla-get-layouts aDoc)
 clyt  (vla-get-activelayout aDoc)
  )
  (foreach
     itm
        (vl-remove (vla-get-name clyt) (layoutlist))
    (vla-copyfrom (vla-item Layts itm) clyt)
  )
  (princ)
)

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Inserting Routine Into Fields

Sep 4, 2012

I have a lisp routine:

(defun getLayout (pos / result cLayout layouts^ i len)
; pos = -1 return previuous layout name
; pos =  0 return current   layout name
; pos =  1 return next      layout name
 (cond
  ((zerop pos)
   (setq result (getvar "ctab"))
  ); case

[code]...

which basically returns either the current, previous or next tab name depending on what you call up. Any way to link this lisp to a field? I am doing some plan and profile drawings which contain match lines I would like to have the match line text automated. For example if I'm on layout called PP02 there would be two match lines in the drawing one would read MATCH LINE PP01 and the other would read MATCH LINE PP03 this lisp routine returns the correct variable but how do I loink this to a fiels?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine During Batch Plotting

Jun 17, 2013

I cannot get my lisp routine to run when I batch plot in AutoCAD 2014.  It's loaded into the startup suite and runs when I open the individual drawings but not during a batch plot.  How can I get this to run during a batch plot?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Routine To Work In 2013

Oct 16, 2012

I don't do a lot of programming and when I do it is mostly with older lisp commands. I have routine that works in 2010 but we are switching to 2013 and it doesn't work. The routine assigns the area of a polyline to a field. The portion of the routine that isn't working is where it assigns the object id for the polyline. Here is that portion of the routine:

;; select an object
 (if (setq ent (entsel))
   (progn
     (setq ent (car ent))
;; Check to see if object selected is a polyline
     (if (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE")
       (progn
;; obtain the object id from the selected entity
         (setq objID (vla-get-objectid (vlax-ename->vla-object ent)))

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Share Routine On Server With Others

Oct 25, 2011

I have created a lisp routine that I would like to share with other CAD users, but it doesn't work on the server, and it works fine on my machine.  Does "findfile" function work on a server environment?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Rename All Layouts?

Sep 23, 2013

I am looking for a LISP to automatically rename all my layouts. I would like the first layout to say "HWY 400 (01)", second layout "HWY 400 (02)", third layout "HWY 400 (03)" ect..

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Getting A Contour Labeling Routine?

Jul 21, 2006

I need a routine that one can select a fence or a path along a whole lot of contours which are not in 3DPoly but rather a heavyweight POLYLINE and then have the Z value (elevation of this polyline) printed over the contour preferably along the direction of the vertex picked.

I have something right now that works by selecting individual plines but I need one you can select a whole lot and have the text inserted at the correct position.

See my simple code below:

;THIS IS FOR LABELLING 3D CONTOURS
(defun C:3DC ()
(graphscr)
(setq p (entsel "
Select CONTOUR to label: "))
(setq e (entget (car p)))
(setq e1 (entget (entnext (cdr (assoc -1 e)))))

[code]....

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Reload Routine For Every Drawing

Oct 16, 2013

I recently upgrading to ACA 2014. I have set my trusted locations, my file path, the startup suite, and the system variable to load acad.lisp on startup. Most of my lisp routines load, but not all. I still have my ACA 2011 loaded, all settings are applied as required, yet I do not have the same issue with the same lisp routines. I have to reload my lisp routines for every drawing.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Revcloud And Delta Routine

Jul 9, 2013

I'm trying to create a lisp routine where It will create a layer for the delta that is needed and at the same time adds the delta. I get delta revisions often and it takes time to add a new layer and a new delta for each plan. I would like to create a routine that creates the the new layer based on the revision number.

For example if I get a revision 2 I would like to have a lisp routine that creates a new layer but asks what number i would like to use, once the new layer gets created the revcloud command would run, I use polylines around my revisions then change them to cloud with the revcloud command. after i pick my polylines to be changed to clouds then it would add a delta block that is in an attribute and it lets me put the number of the revision i want. At the end I would have a new layer, a cloud around my revision and a delta corresponding to the revision number i'm currently working with.

I have a routine that creates the new layer, sets it current, and starts the revcloud command where i can pick the objects to change to clouds, after that I'm stuck, I'm not sure how to tell AutoCAD that after the selection is made to start the insert command to insert that delta attribute block. I mean the routine ends after i pick my objects, I tried doint the delta first but i ran into the same issue since my routine ends after AutoCAD ask me to pick a location to put my delta block.

I need to figure a way to tell AutoCAD that after something is picked or selected then to continue with the lisp routine without ending it. I atteched an example of what I have.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Rotate Text

Sep 18, 2013

I was wondering if there is a setting somewhere that could hold my snapmode settings after I use a lisp routine. I found a lisp routine to rotate text and have noticed that everytime I use that lisp command I lose my osnap settings....

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Selecting File Location In Routine

Oct 19, 2011

I wrote this small program to automate plotting a drawing to pdf. Everything work fine except I cannot figure out how to allow it to let me pick where I want the file created and what I want to call it. In this routine, the "" at the 3rd from the end place will just automatically name the file and put it in the parent folder. If I replace the "" with pause, it lets me change the name, but will not let me choose the location.

What I'm looking for is for a dialogue box to pop up (explorer style) that will let me choose a location and name the file. This is what happens if you do it "long hand" inside ACAD, how to do it in the code.

(defun C:clpdf ()
(setvar "cmdecho" 0)
(setvar "osmode" 0)

[Code]....

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Set ByLayer Routine Won't Execute Properly

Jun 19, 2013

Me and a friend are trying to work on a LISP routine to select objects in a drawing and change their attributes to "ByLayer" and other things. He is a familiar with the AutoCAD commands, I have a general idea of how to use LISP and we're trying to put our heads together to solve some workflow issues at our job.

-aDiagram
 
(defun c:set23 ()(setq uecho (getvar "cmdecho"))(setvar "cmdecho" 0)(command "setbylayer" "al" "" "n" "y")(command "-layer" "c" "23" "*")(command "-xref" "d" "*")(command "-purge" "al" "" "*" "n")(setvar "cmdecho" uecho)(princ))

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine No Longer Working In 2014?

Sep 4, 2013

One of our users has recently upgraded from AutoCAD 2005 to AutoCAD 2014. He has a LISP routine that will no longer work and I'm not sure why.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine For Replacing Line With Block?

May 21, 2012

Lisp Routine that could replace a line at a specified maximum length with a block at the lines midpoint.

I would love to be able to replace all lines I select which are say less than 0.5m in length with a block at the lines.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Scale Text Objects

Jan 8, 2014

Any Lisp Routine to scale text objects a certain value and have the program actually scale each text object as you pick them.

The change text height using the Properties function does not work for what I need because the objects I need to scale are Mtext objects with Background Mask, and when you use the Properties function to change their text height it messes up the background mask so that you have to select each text entity and stretch the mask area smaller or larger, but if you use the scale function it scales the background mask as well so the background mask coverage is still the same.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Load Particular Object Snaps?

Jun 20, 2011

A lot of the LISP routines we use turn off all snaps except the "nearest" snap when the routine is complete.

I draw with 6 out of the 10 snaps on (not the nearest).

LISP routine that loads specific object snaps?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Label Difference Routine Adjustments

Aug 18, 2011

I found the following lisp routine on the forums and would like to know how to make a couple changes.

1. Have two line of text with the N or S on top of the E or W.

2. Include the foot symbol after the distance

3. Have the N,S,E,W placed before the distance, ex S 0.00'

4. Eliminate the negative sign

5. Use my current text height instead of dimtxt height

(Currently using Autodesk Land Desktop 2009 and want the text to come in based on the current text style since we use several different scales and text depending on project)This is a great routine that is going to make life much easier for us.

(defun C:LBD (/ P1 P2 TX);label difference
 (while
 (setq p1 (getpoint "
Specify first point or press Enter to Exit: "))
 (setq p2 (getpoint p1 "
Specify second point: ")
 ydiff (- (cadr p2)(cadr p1))
 xdiff (- (car p2)(car p1)))
[code]....

View 5 Replies View Related







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