AutoCAD Visual LISP / AutoLISP :: Zoom Extents Upon Opening A Drawing?
Nov 13, 2012
What i would like to do is have autocad do a zoom extents automatically when I open a dwg. Is there a lisp routine that I can run to do this? I use to have something that would do this but I started a new job and cant remember.
View 3 Replies
ADVERTISEMENT
Mar 10, 2009
I'm currently working in a drawing that has 148 layout tabs and I frequently work in drawings with more tabs than that. when I switch tabs, I like to see everything in the tab. Is there a lisp that will do a zoom extents in every tab so I don't have to manually do it all the time?
View 9 Replies
View Related
Oct 12, 2012
I have a drawing with various layouts that when I do a Zoom Extents the drawings is reduced to the size of a point.
I have done all the usual, ie: look for extra entities that are "out in space" so to speak and there are none.
I wonder if I have a block or image which may have an insertion point "out in space" and if this may be the issue.
Is there some way to Select all entities or Blocks (insertion point) that may exist outside a particular area ie: drawing limits.
View 3 Replies
View Related
May 26, 2010
how to make a routine for zoom extents, save all, and close all open drawings in a single routine?
View 3 Replies
View Related
Jun 21, 2012
I am having trouble opening a drawing created by other software, I am using the following
(defun c:water ()
(setq acApp (vlax-get-acad-object))
(setq acDocs (vla-get-documents acApp))
(vla-open acDocs "L:/GIS_CAD/CAD NZMG/Water/Water Nov08.dwg")
)
If I try the routine I get ; error: Automation Error. Error Decrypting Data.
If I open the drawing normally (that works) and save as a dxf, then open the dxf and save it again as a dwg the routine works. I use the routine for 5 seperate drawings that get updated every month and would rather have a routine that opens the drawings without the fiddle.
View 7 Replies
View Related
Apr 23, 2010
is there any way to freeze a layer without opening the drawing in lisp?
View 7 Replies
View Related
Oct 7, 2013
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)
View 9 Replies
View Related
Dec 18, 2012
I just started learning LISP yesterday, as our office needs an autosave LISP. People have requested it and I have to do it...
How I wanted to do it:
The LISP will be loaded on every PC of every person with AutoCAD.
On startup "command_count" will be on 0
When using a command like plinie this happens: (+ 1 command_count)
Commands like zoom, undo etc will be ignored
When command_count reaches 20 it executes the qsave command
If using the qsave command it resets the command_count to 0
Thats my not working LISP atm:
(defun c:losave ()(setq command_count 0)(+ 1 command_count)(if command_count 10 "_qsave"));(if command "_qsave" setq 0);(if command "_zoom" (- 2 command_count));(if command "_undo" (- 2 command_count));(if command "_qsave" (* 0 command_count));(setq command_count (+ 1 command_count))
View 9 Replies
View Related
Dec 15, 2011
can do a routine that zooms into a coordinate, based on input. So for 1A, it would zoom into the coordinate for 1A.
1A = 1,1
1B = 1,2
1C = 1,3
1D = 1,4
I will try to attempt one shortly and will post it within 1 hour.
View 9 Replies
View Related
Jul 25, 2012
The good news is that, if I were righting a routine that locks up AutoCAD, I'm finished. The bad news is that I'm not.
The code below is the portion of a routine where I have the user select 2 points and then pass those points to the Zoom command and the M2P osnap. The problem is that, when the Mid Between 2 Points osnap tries to use the first point, it returnns an "Invalid point" message, enters a loop and locks ACAD.
(defun C:ZC ()
(setq PointOne (getpoint "First point of M2P "))
(setq PointTwo (getpoint "Second point of M2P "))
[Code].....
View 2 Replies
View Related
Jun 14, 2013
I am looking for an example excel macro to zoom to an object given the obect entities handle.
View 2 Replies
View Related
May 17, 2012
Right now I'm working on a program that will go into a directory and it's subdirectories, collect a list of all the .dwg files in those directories, then apply certain changes to all of those .dwg files.
My problem is that none of these things works.
(command "open" (srtcat basedir (nth i file)))
(command "open" (nth i fullfile))
(vl-cmdf "open" (strcat basedir (nth i file)))
(vl-cmdf "open" (nth i fullfile))
Where "basedir" is the main directory (e.g. C:/...), file is the list of the dwg file names (e.g. mydrawing.dwg), fullfile is the list of the ull paths (e.g. C:/.../mydrawing.dwg)
I have tried using the filename with and without the .dwg extension with no luck.
I have this code set in (while ...) so that it will go through all the files in the list "file" or "fullfile" in sequence. The lisp will run without errors but will not open any of the files. When I look at the command line, I see that the lisp has put open on the command line like it has executed the command, but right below that, it says "Unkown command: C:/.../mydrawing.dwg" or "Unkown command: dwg" depending on which of the above code pieces I'm using.
View 1 Replies
View Related
May 28, 2013
I have used Autocad since 1991, and my current job required me to use Microstation. One feature I liked from Microstaiton is the ability to select and open an external DGN reference, and then match the view of the parent DGN. In AutoCAD, you can also select and open an xref, but the DWG opens to the previous saved view, and not to the desired view that matches the layout.
My thought was to experienting with lisp or scipt and export the "Viewctr", "Viewtwist" and "Viewsize" variables to a text file, then importing the text file and using the "Viewtwist" as my "SNAPANG" value, then "Viewctr" as my "ZOOM, CENTER" value, and finally the "Viewsize" as the "Enter magnification or height:" value.
But, alas, have no time, and not quite the knowledge to duplicate MicroStation's open-xref-and-zoom-to-view feature.
View 6 Replies
View Related
Jan 1, 2012
I still want it to have its normal behavior while in a command, but when not in a command it still enters the selection mode, which does not work, but if it would enter a zoom window command, it might be a more useful command.
View 5 Replies
View Related
Jun 2, 2011
My drawing
Zoom Window.jpg
and AFTER I zoom extents
Zoom Extents.jpg
why does it zoom IN after zooming extents?
View 5 Replies
View Related
Oct 13, 2013
I am trying to put together a lisp routine for exporting a Civil3D drawing to basic autocad entities and convert it to a clients layer standards.
I don't want any user input, so I see two problems with the routine at the moment.
Step 2. SAVEAS - I want the drawing to be saved in the same directory as the current drawing, either called "CLIENT_export.dwg" or preferably "Export_{current drawing name}.dwg". If the dwg exists I want it either to overwrite or increment a suffix number.
Step 4. At the moment it askes the user for a selection, I want it to select "ALL"
;;;Purpose to convert a Civil3D drawing into CLIENT layer standards.
(defun c:client ()
(setq old-echo (getvar "CMDECHO"))
(setvar "cmdecho" 1)
[Code]...
I don't have any experience with LISP or any other programming. I have just been cobbling this together from bits and pieces I have found on the web.
View 3 Replies
View Related
Apr 22, 2012
how to open an dynamic block DWG using a script and not have the "This drawing contains authoring elements. Do you want to open in block editor" message?
I cannot seem to get rid of this message and everytime I have to manually say "No" and let the script run.
View 1 Replies
View Related
Jan 29, 2013
I need to write some code to count blocks inserted on the drawing.... I want to count also dynamic blocks... most of the time dynamic blocks are anonymous... so I'd need to check the Effective Name.
This line gets the blocks in the block table...
... but how do I get the blocks actually inserted in the dwg?
(setq blks (vla-get-blocks odoc))
Will a regular lisp expressions (like below) work with ObjectDBX... (drawing file not open)?
(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "`*U*"))))
View 2 Replies
View Related
Feb 11, 2013
is it possible to bind an an xref via ObjectDBX without opening the drawing?
View 1 Replies
View Related
Mar 7, 2013
I want to insert another drawing layout tabs contents in current drawing.
It's easy for MODEL tab, but for LAYOUT tabs, I dont know how!?
I prepared a code for INSERTING MODEL tab in current drawing:
(defun INS_DWG (TAB path dwg P / blk)(setq blk (strcat ""*" path dwg """));(setq N (vla-get-count (vla-get-layouts)));;Number of LAYOUT TABS in dwg(if (or(= TAB 0) (= TAB nil))(command "INSERT" blk P 1 0)); TAB=0 or omitted ==>Insert MODEL;(if (= TAB 1));==>Insert the 1st LAYOUT in dwg file;(if (= TAB 2));==>Insert the 2nd LAYOUT in dwg file;and so on....);;;usage:;;(INS_DWG 0 "c:\test\" "test.dwg" '(0 0))
View 8 Replies
View Related
Mar 13, 2012
Currently I am using 2010 Map 3d, for water main base plans.
I use Micro Survey to process my field work. From there I open in Cad, import layers from our GIS data base for property, buildings, addresses, etc.
The only thing I have done different is from another project was copy and paste some utility layers.
Now my drawing turns any plines with width into hollow lines, and if align something my drawing will zoom to extents, also text mask does not work and i tried turning text to Mtext and it will not let me select yes for background mask.
All other drawings I check everything works fine.
View 3 Replies
View Related
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
Oct 18, 2002
How can you open a drawing read-only with autolisp.
View 9 Replies
View Related
Oct 7, 2011
Any lisp routine out there to append (prefix) text to dtext?
i have 100s of dtext that has numbers in them, and i need to place the "#" symbol in front of them now.
View 3 Replies
View Related
Apr 22, 2013
I am trying to insert one or another block into a drawing, and i need to do this 8 times per drawing.
(defun C:detector (/ filename gas pressure)
(repeat 8 (initget 1 "Gas Pressure")
(setq filename (getkword "
Enter Detector Type [Gas/Pressure]: "))
(if (= filename "gas") (command "-insert" "*T:\acad\schematic_circuits\suny\sunygasdetectornew.dwg" pause "" "")
(or (if (= filename "pressure")
(command "-insert" "*T:\acad\schematic_circuits\suny\sunypressuretransmitternew.dwg" pause "" ""))
) ;;end or
) ;;end if
) ;;end repeat
)
View 4 Replies
View Related
May 27, 2012
I am working on a lisp that automaticaly draws some tubes and fittings.First the user has to select the block where the tubes start and then he selects where the tubes has to end.Herefor i whrote this lisp..
(defun c:test () ;;------------=={ Set Dynamic Property Value }==--------------;;;;;;;; Modifies the value of a Dynamic Block Property ;;;;-------;;;; Author: Lee Mac, Copyright © 2010 - www.lee-mac.com ;;;;---------------------;;;; Arguments: ;;;; block - VLA Dynamic Block Reference Object ;;;; prop - Dynamic Block Property Name ;;;; value - New value for Property ;;;;------------------;;;; Returns: Value property was set to, else nil ;;;;-------------------;;(defun LM:SetDynamicPropValue ( block prop value ) (setq prop (strcase prop)) (vl-some (function (lambda
[code]....
Is it posible to show the user how the tubes gow befor chozing the second point?(A litle bit like when you stretch a dynamic block where you can see how the object will look like while preforming the stretch action).
View 2 Replies
View Related
Oct 4, 2013
As you smart individuals can figure out, we do up drawing packages for construction that consist of several drawings, hundreds of drawings, for several modules of construction. Our process usually consists of one layout per drawing, so that the lisp guy can do a drawing count and put in sheet numbers based on how I manipulate the list of drawings in the one directory folder.
Now I have a client, despite the way we currently do things, requires that about 70% of the drawings will have multiple layouts. Now we're back in the stone ages, manually putting in sheet numbers, eating up our budget for this contract.
View 4 Replies
View Related
Aug 19, 2013
how to use AutoLISP to draw lines between two points. I have x,y,z coordinates for the end points in an excel sheet which I can save as a text file. I need to pull the coordinates from the file and use them to draw the lines. There are 2000+ lines so it is not feasible to draw them manually.
View 8 Replies
View Related
Dec 5, 2012
I have the following string of code, that I'll write in everyone's start-up suite. I'm able to retrieve a list of files I want to modify, for whatever reason. (One example, when plotting drawings with layouts, sometimes the shadeplot setting is wireframe, and not classic hidden, though it's been set up in our templates).
The huge question is, can I get a list of drawings to a variable in one drawing, and have access to that variable list, in the next drawing I open? I'll iron out the bugs on read-only statuses, or manipulating drawing states later.
(defun GetDrawings ()
(setq currentpath (getvar "dwgprefix"))
(command "pspace")
(setq DrawingList (dos_getfilem "Select a file" currentpath "Drawing files (*.dwg)|*.dwg|All files (*.*)|*.*||"))
(setq ListOfDrawings (cdr DrawingList))
(setq DrawingPath (nth 0 DrawingList))
[code]...
View 1 Replies
View Related
Oct 2, 2011
I know through the block command you can write out a selection of entities to a single drawing.But what I am wondering is if it is possible to have two drawings open, and transfer data quickly between the two?
As an example as we are detailing an assembly we create a title block around a detail, put dimensions and notes on as needed and would then like that to be transfered into another drawing next to the previously transfered detail drawing.
View 9 Replies
View Related
Jul 30, 2013
I'd like to create a lisp that would check my drawings for stray vertices (I only draw in full measurements per UCS), and automatically round them up to the closest whole value, or at least mark them up in circles for manually fixing them.
View 1 Replies
View Related