AutoCAD Visual LISP / AutoLISP :: Moving Objects To Different Layer Is Slow

Nov 26, 2013

I find that the command to move objects to a different layers runs very slow in one of the drawing.  I want to find out what wrong with the drawing and how to speed things up.

I have a LISP program that batch processes a large number of drawings.  One of the step to process each drawing is to change the colors of some objects according to the status of the objects.  I do this by moving the objects to a later that has the right color.  So far the program only takes 2 to 4 minutes to process each drawing.  But the program takes close to 90 minutes to process one specific drawing.  I track down the problem has to do with the command that moves the objects to the right layer, like this:
 
(vl-cmdf "_.chprop" (ssget) "" "_layer" "ABC-Prod-Good-Pcs" "")

 This command takes a very long time to finish, like 40 minutes each time it runs (to move 1200+ objects), and the program needs to run it twice for a total of approximately 80 minutes.

Please note that the drawing itself is not the largest drawing, and it doesn't have the largest number of objects to be moved either.  It is close to the top-5 drawings in term of drawing size and the number of objects to be moved. I cannot say that the drawing size or the number of objects to be moved are the cause of the problem.

I tried to "speed up" by moving 200 objects incrementally.  That didn't work. I tried to "speed up" by moving 100 objects incrementally and saving the drawing after each 100 objects are moved.  That didn't work either; actually the speed is slightly slower than simply moving 1200+ objects all at once.

I don't know what to do.  I believe there may be something unusual about that drawing.  By the way, the reason why I choose to change color by moving objects to a different layer has to do with the fact that I have found this is the best way so far. I tried to change the color of the objects directly.  But I find that the color of some sub-parts of the objects are not changed (because their color is by-layer). That's why I choose to change color by moving objects to a different layer.

How I can check the drawing, any different way to change color that is better.

View 5 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Moving Objects In The X / Y Plane Only

Jul 29, 2013

I want to move a large 3D steel file on top of a 2D architectural background. The ISSUE is that when i move it (in plan view "aka top view") the X,Y coordinates change AND the Z coordinate changes... But, I want the Z coordinate to stay the same . I wrote a LISP file that doesnt seem to work (SEE BELOW):
 
(defun C:MoveXY (/ PT1 PTB PT2)(setvar "CMDECHO" 0)(setq PT1 (getpoint "
Specify Base Point or [Displacement] Displacement: ")PTB (getpoint "
Specify second point or <use first point as displacement>: ")PT2 (list (car PTB)(cadr PTB)(cddr PT1)))(command "_.MOVE" (SSGET) "" PT1 PT2))

It seems my issue comes when i get to the command line (ssget) seems to mess it all up . How to use the ".Move" command with the (ssget) function?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Moving Objects Vertically In 3d View

Jan 1, 2014

I am having trouble moving an object a certain distance. The distance is defined by a pre-defined variable. I just can't figure out the syntax for the autolisp command.

Here is the bit of code if written, there is more code not shared here that defines the points for the polyline .

;-- the varaible box_height is defined earlier in the routine

;-- Draw the polyline for the top of the cabinet
(command "pline" p1tt P2tt P3tt P4tt P5tt P6tt P7tt P8tt "c")

;-- Assign the new part a variable name
(setq cab_toppl (entlast))

;-- Extrude the polyline to make the top of the cabinet
(command "extrude" cab_toppl "" cab_intw "0")

;-- Assign the new part a variable name
(setq cab_top (entlast))

;-- Rotate the top of the cabinet down to the floor of cabinet

(command "rotate3d" cab_top "" 2 p1tt p2tt 90)

;-- Move the top of the cabinet to the final location

;--  HERE IS THE PART I'M HAVING TROUBLE WITH.  ESSENTIALLY ONCE THE PART IS CREATED I'VE NAMED IT CAB_TOP AND AM NOW TRYING TO MOVE IT IN THE Z AXIS THE DISTANCE DEFINED BY THE VARIABLE BOX_HEIGHT WITHOUT USER INPUT

(command "move" cab_top "" "0,0,0" (list (0 0 (box_height) "") 

;--THIS PART IS OKAY

(setvar "CLAYER" oldlayer) ;restore active layer

(setvar "BLIPMODE" 1)
(setvar "OSMODE" 135)

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Moving XRefs To Another Layer

Oct 31, 2011

I have been looking around the web to find a quick lsp routine that will take all the xrefs in a drawings and move them back onto layer "xref" or "0" depending on what the design team wants.

The ones I have found don't work or move all the xrefs to separate layers.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Move Objects To New Layer Based On Their Present Layer

Jun 20, 2012

Say I have 2 items, one is on layer "M-Duct" and the other on "M-Pipe" (they are in the same drawing). Any lisp routine that would create the layers "M-Duct-New" and "M-Pipe-New" (based on the same color and LT as the original layers) and then move those objects to the newly created layers?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Change All Objects On Layer 0 To Existing Layer PC Module

May 31, 2012

I'd like to have/write a lisp to change all objects on layer "0" to layer "PC - Module"

If possible also;

save the document close the document open next in directory run layer changer program again.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Getting Objects Layer?

Feb 7, 2010

How can I get the layer that an entity is on. I have tried numerous method but they don't seen to be retrieving the layer information.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: New Layer For Selected Objects

Jan 1, 2014

I need a LISP that create a new layer and ask me for the name and the other properties (color,lw,lt..).

ask me if I want move the selected object for the new layer (yes is the default value)

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Converting Objects Of Certain Linetype To A New Layer

Oct 26, 2012

I would like converting all objects that has forced linetype to be on a linetype layer.

So if there are objects that have forced linetypes - dashed/hidden/phantom, etc., those entities would be moved to a linetype layer based on their forced linetype.   The entities would all be changed to color bylayer, linetype bylayer.

So if there is a rectangle that is sitting on an EQUIPMENT layer, the routine would put that rectangle on a new layer called DASHED and change its forced linetype to BYLAYER.

Lastly, once that's done, the next and final step is to locate a the existing layers with matching linetype - say, OBJECTS with DASHED as a linetype, and merging it to that layer.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Change Colors Of All Objects In A Layer

May 30, 2013

Can I have a lisp to select all objects in the layer "Defpoints" (including model and paper space, and including objects inside blocks) and change the color of those objects to color 30?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete All Objects In All Layers Except One Layer?

Jul 29, 2013

lisp program to delete all objects in a drawing based on Layer excluding one layer objects.

in AutoCAD.

Example : I may have 10 layers in a drawings like 1 to 10. I need to delete all objects on 2 to 10 layers.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Disable Snap For Specific Objects Or Layer?

Nov 28, 2012

Is there a LISP code for disabling OSNAP for specific objects or layers?  An automatic disable for multileaders would be useful when fine tuning the text placement. Trouble is you need the snap for the leader end. Maybe you could disable the snap for the text grip only. 

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Moving Attribute Block With Tag String Name

Dec 20, 2013

I have a lot of attribute blocks in my drawing which i want to move them one by one

so , here is what i want to do :

I have numbers (or texts) in my work area and this numbers also exist in my attribute blocks .. i wanna move my attribute blocks with tag name value reference to my specify area if tag name values are matching with text or numbers in this area .. every block will check my selected tag string and will be move on matching text in my work area.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Moving Object From Layout To Another Programmatically

Dec 14, 2011

how to do this programmatically and without modifying the handle of the object,i am trying to do it programmatically (entmod (cons 410 newname)(assoc 410 ... no luck.

(entmakex -ing will modify or create a new handle ctrl-X and then ctrl-V recreates a new handle too ...

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Script For Moving Drawing In Multiple Drawings?

Apr 23, 2013

QT : 1 . I  am looking for a script to move the drawing such that the left bottom corner is placed at 0,0  without any manual intervension. This is to done for all the files in a particular folder.

QT : 2   In the same script file I want one block to be inserted also in each drawing. the block is placed in the network drive . so how to copy the path after putting the insert command.  I tried -insert;  but it is not working how can i give the path in script file.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Prevent Certain Object In Layer Change To New Layer Automatic?

Apr 17, 2012

lisp..It work fine but just that i need some minor modificatio to it...At moment, when i activate the lisp, it will automatic select all dimension,leader and multileader to a layer call "DIMENSION"...Anyway i wonder if it is possible to prevent any dimension,leader or multileader in layer "Section" will not be change to layer "Dimension"?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Link Xref Layer To Local Layer - Same Display

Feb 21, 2013

Possible to link an xref layer and local layer so they display the same (eg. sync viewport colour, linewieght, line type)?

I insert xref's for my base drawing but legend is on local layers and I would like to be able to ensure that the line colour and linetype always match...

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Leader On Layer And Still Remain On Original Layer

Aug 28, 2012

I have a customized button to draw an ‘ac-arrow’.  I created a lisp to create the layer “G-ANNO-LEDR”

if the layer name is not found.  The advanced part I would like is:

Current layer:  E-ANNO-WIRE

Ac-Arrow Leader:  G-ANNO-LEDR

OPTION 1:

If, say I am on current layer “E-ANNO-WIRE” and need to draw my “ac-arrow” leader, and continue working

on the original layer “E-ANN-WIRE”  (and have the leader  be drawn [remain] on the layer “G-ANNO-WIRE”).

With this option, I have the block “ac-arrow” imbedded in my template drawing file to have the block at hand.

With this option, the layer “G-ANNO-LEDR” will be created IF it is not on the drawing.

OPTION 2:

- Currently be on layer “E-ANNO-WIRE”

- Bring in the block “ac-arrow” from my block library “L:AutoCADSymbols”

- Draw the “ac-arrow” leader which will be on layer “G-ANNO-LEDR”   (this layer created IF it is not

  on the current drawing).

- After the leader is drawn’

- Be put back to the layer I was,  “E-ANNO-WIRE”, and continue working.

The OPTION 2 is what I would really like to have.  A while back, I happen to see one like OPTION 2, but I cannot

find it anymore on the users groups.  I have been searching for a while now.

Currently, I use the button in my customized toolbar (see image) and have to have the “ac-arrow” block in my drawing and have its layer created in the drawing.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Script That Assigns Lineweights To Layer Based On Color Of That Layer

Nov 19, 2013

Any script that when ran will set lineweights of a layer based on what color the layer is assigned.  For instance if I have 3 lines that are green on 3 different layers. I need the script to change all 3 layers lineweight   to .015mm. I have drawings that are inconsistant with layer names so layer translator and methods of that nature will not work because I do not know all the layer names and I have 100 drawings to do this to.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete All OLE Objects From Drawing

Nov 26, 2012

how to delete all OLE objects from drawing by most efficient way.

There are abt 150 drawings, each has from 2 to 20 or so OLE objects which need to be deleted. OLE objects are on many paper spaces.

I tried to use qselect but it selects only what is in current space.

Would need some lisp or some other methode than all can be deleted (excluding those which resides in blocks).

Tried also yto use ssx and then erase but still it deletes only what is on current space.

Just as additional info, those OLE are all pictures, not xls files for example.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Reactors And Objects With Fields

Mar 7, 2012

I am trying to add a reactor, where if the object i move or copy is s a block of a certain name, then i would like to run update field on the last object (being copied) or the object being moved.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add Multiple Hyperlinks On Objects

Jan 11, 2013

The below adds a hyperlink to the selected object.How might it have to change to add multiple hyperlinks?

(entmod
 (append (entget (car (entsel)))
     (list
      (list -3
         (cons "PE_URL"
            (list
             (cons 1000 "..\..\90 Submittals\90-3 O&Ms\fig83-clevishanger.pdf") ; Relative Path to a pdf file.
             (cons 1002 "{")

[code]...

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Take Two Objects And Swap Their Positions?

Sep 19, 2011

I have been searching for some information on how to pass objects into a function so I can mess with their properties. Somehow I haven't been very successful. Anyway...What I want to do is take two items (light fixtures) and swap their positions on the drawing. It seems like it must be really simple, but I'm just not finding the key puzzle pieces to do it. It seems like if I could figure out how to pull two objects into the function (whether by selecting them and running the function or by selecting them after I run the function) I could very easily save the coordinates of one to variables and then just swap them.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Exporting List Of Objects

Jan 6, 2012

How to export to a txt file a list containg all the objects on the current layer and their properties?

To be precise, I would like to export the following items from a selection of plines:

- ObjectID;
- Start Point;
- End Point;
- Vertex Points;
- Width.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Objects With Given Xdata?

Jan 2, 2012

with a function like this I added some xdata, some MULTILEADER

(defun c:add_xdata () (princ "Select: ") (setq ogg (car (entsel))) (addXdata ogg "TEST" "CODICE" "1256") (addXdata ogg "TEST" "MATERIALE" "LEGNO") (addXdata ogg "TEST" "TIPO" "A"))
 
Now with the following function can only select leaders who have linked the xdata application TEST

(setq selez_all (ssget "X" '((0 . "MULTILEADER")(-3 ("TEST")))))
 
I can not, however, find a way to select all MULTILEADER who have a particular value of XData.

For example I would select all MULTILEADER with MATERIALE = "LEGNO" and TIPO = "A".

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Selecting Multiple Objects

Nov 2, 2011

How to modify this routine so that I can select multiple objects as opposed to one at a time?

(Defun c:cd ()
(setq newdim (entsel "
Select Dimension to clear:"))
(setq newdimvalue " ")
(command "dimedit" "n" newdimvalue newdim "")
(princ)
)

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Area Of Multiple Objects

Nov 3, 2008

I have a lisp I use to calculate the area of an object. The section below is the area part of it:

(setq ojt (entsel "Select object to get area of... "))

(command "area" "o" ojt)

(setq oarea (getvar "area"))

I want to modify it to add the areas of multiple objects. Unfortunately it is not as simple as;

(setq ojt (ssget "Select object to get area of... "))
(command "area" "a" "o" ojt)
(setq oarea (getvar "area"))

So how would I go about doing it?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Possible Select All ANNOTATIVE Objects In A DWG

Jun 20, 2012

is it possible select all ANNOTATIVE objects in a DWG and  to set a Viewport/ANNO scale for all  via lisp

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw All Objects At Same Time?

Sep 24, 2012

I have made a lisp routine to draw lines on polyline. And here are a lot of lines on it. So using comand

"(command "line" pt1 pt2 " ")"

takes a lot of time. Is here a way to creat lines in memory or similar and only then draw them all on screen?

I have search but coudin't find any info. I do not know how to formulate a query.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Detect If There Are Objects Selected

Oct 18, 2012

Any way to detect of there are objects currently selected using Autolisp, visual lisp or even VBA. I would like to be able to do something using that as a conditional, so that (assuming the hypothetical variable isSelected is an on/off indicator of whether or not something is selected) I can code something like this:

(if (isSelected) (...))

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Move Selected Objects By Value Of Their X Or Y Properties

Nov 23, 2012

I need a program to move some selected text to a line something like as extend command but for text objects!

suppose that there is a horizental line (y=constant) or vertical line (x=constant) and some selected text(or other objects), I want a lisp program that move these selected text (or objects) by their "insertion point" to this line.

in other word, if the selected base line is horizental (y=constant) then property of "Y" of all selected text should change to line's "Y"; and if selected base line is vertical (x=constant) then value of "X" of all selected text should match to line's "X" value.

for example, for base vertical line (x=constant) and 3 selected text(or can be any object) result is:

text1.          |                        text1.|

  text2.        |         ===>       text2.|

    text3.      |                        text3.|

|  .text1                                 |.text1

|    .text2                ===>       |.text2

|      .text3                             |.text3

View 9 Replies View Related







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