AutoCAD Visual LISP / AutoLISP :: CANNOSCALE / SCALELISTEDIT Creating And Setting?

May 6, 2007

I would like to be able to check if an Annotation Scale already exists and if it doesn't I would like to create it using the SCALELISTEDIT command and then set it to be the curent scale. I then plan to invoke the MLEADER command.

I do not want to have to rely on adding every possible scale in the list beforehand as my program would fall appart when a user decides to set an unusual scale I haven't thought of adding to the list.

See my initial start of the program.

(defun C:MLD ()
(command "cannoscale" "1:55") ;STOPS HERE WHEN 1:55 DOES NOT EXIST
(setq IfAnnoScaleExists (getvar "CANNOSCALE"))
(command "-scalelistedit" "add" "1:55" "1:55" "e")
)

View 5 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Set Cannoscale By Selecting Dims

Feb 9, 2012

I am still green at lisp creation.  I would like to create a lisp to change my cannoscale to match that of an existing dimension in model space.  we use tabs and therefore have many different scales for the vports in our drawings.  i want to be able to type my command, have acad ask for a annotative dimension to match, i click it, then the lisp resets my cannoscale to match.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: CANNOSCALE Value Needs To Match Existing Named Scale

Jan 18, 2012

The crux of the matter is that the CANNOSCALE value needs to match an existing named scale.  This lisp is part of a bigger lisp and I need to pass a variable into it.  Here's what I have:

(setvar "CANNOSCALE" (strcat "1" = " (rtos variable 2 0) "'"))

But I get this error when I try to run it.

; error: bad argument type: numberp: nil

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Cannoscale Applies The Current Annoscale To All Objects

Mar 31, 2013

cannoscale applies the current annoscale to all objecs...i would like to apply it to specific objects? 

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Setting Workbook Already Open?

Nov 3, 2011

I need to use visual lisp to set the workbook if it is already open. What is the syntax for this?

I got the ExcelApp already set as well as the FilePath.

If the workbook is not open then this works

(setq WorkBook (vl-catch-all-apply 'vla-open (list (vlax-get-property ExcelApp "WorkBooks") FilePath)))

I want to be able to see if the workbook is already open and if so set it otherwise open it.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Setting A Previous Selection To Nil?

Jan 12, 2012

How to Set a previous selection to nil from say a move command? 

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Setting System Variables

Feb 23, 2012

a simple lisp file?

I want to set "hideprecision" to 1. This variable can not be saved - I looked it up in Express Tools.

So I thought a lisp file to load at start up would do the trick.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Setting Trusted Paths

Oct 15, 2013

I can use for startups on new work stations. It will set all our custom search, toolpalette, and plotter paths and I have it working pretty well. My last hurdle is to add a trusted path to the environment to avoid users having to ok the startup lisp.

Here is a piece of the *file* is set further up in the code. It works line by line but evidently "vla-put-trustedpaths" is not legit. How can I get the additional trusted path written in to the environment?

(setq trstpath "");initialize
(setq trstpath (strcat trstpath (getvar "TRUSTEDPATHS")))
(setq trstpath (strcat trstpath ";\\CAMERONFS1\AutoDesk\ACAD SUPPORT\C3D2014 Support\LISP;"))
(setenv "trustedpaths" trstpath)
(vla-put-trustedpaths *files* trstpath) 

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Set Auto Constrain Setting?

Jul 12, 2013

Is there a way to set the Auto Constrain setting using lisp. I would like to be able to run a quick constrain all and then delete all constrains to fix gaps in geometry. However I only want to use the coincident, Vertical and horizontal.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Setting A Custom Scale On Viewports

Aug 29, 2012

I have a problem that I cannot seem to solve.  I have a drawings with a whole bunch of layout tabs that have a few viewports in each tab. One of these viewports on each layout tab is on the layer VIEWPORT. I did this so it would be easy to filter out the other viewports in the drawings. I am using the code below to change all of the viewports with the layer VIEWPORT to the Custom Scale 0.020833. This works for all of the layout tabs except the first tab. It will not for some odd reason work on the fist tab. 

(setq vieportfilter (list (cons 0 "VIEWPORT")))
(setq ssetvp (ssget "x" vieportfilter))
(setq cntrp 0)
(while (< cntrp (sslength ssetvp))
[code]..........               

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Setting Dynamic Block Visibility?

Aug 17, 2011

Attached is a lisp that reads an attribute block value and uses that value to set a named view. The attribute block is a diesel expression field which reads the drawing number, so it changes as the drawing is saved to a new number. I use it when I am preparing road alignment drawings. I prepare the first drawing in the set, saving views for all drawings and when I'm done I copy that drawing 001 as many time as I need, rename them drawing 002, drawing 003 etc. and use the attached lisp with scriptpro to set all my saved views.

I also have a dynamic block called "key" in the drawing with visibility states matching the named views.

either expand this lisp or create a new lisp to set the visibility using the "VN" variable.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Setting Option For 1"-30' Viewport Scale

Oct 18, 2013

calculation a viewport scale of 1"=30'.

I've looked around and only find nearly what I looking for. For 1"=20' I have a value of 0.004167 Paper Units = 1 Drawing Units, but what is the formula to calculate 1/30"=1'-0"?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Setting Support File Search Paths In Routine?

Nov 8, 2013

I have a simple lisp routine that loads everytime one of my users opens a new drawing, It sets the printer paths, sets the template paths and sets a bunch of environment variables

One thing I would like to add to this lisp routine is the ability to add support file search paths.

Is there a simple setenv variable for this? or is it more complicated?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Mleader Style - Arrow Head Size Setting

Nov 17, 2009

I have some working code that sets the Text Style name to ROMANS inside my Mleader Style called ARROW. Here it is:

(setq dict (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE") ; start setq q
dict1 (member (cons 3 "Arrow") dict) ; code 3 is Mleader Style Description
el1 (entget (cdr (assoc 350 dict1))) ; code 350 is dictionary entity handle
er (tblobjname "style" "Romans") ; new value for MLEADER Text Style
) ; end set
(entmod (subst (cons 342 er) (assoc 342 el1) el1)) ; code 342 is MmTextStyleId - write new vale to mTextStyleId

I want to modify this code so that it sets the Arrow Head Size to a specific value, say 0.125. Having a tough time figuring out the DXF codes and tblobjname to do this.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Drawings From Excel

Dec 16, 2011

This probably isn't the correct discussion group but not sure where else to post this. 

My sales department wants to be able to create drawings based on entries in selected in their Excel qouting tool.  Basically, they want to configure a product in the field, and be able to show the customer the drawing with TrueView. (They don't have AutoCAD installed).

I would think the best I can do, is manipulate a .dxf file based on their selections but that may get very complicated.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Variable Names

Nov 28, 2008

How to write some code which could create variable names like var1, var2, var3, etc. I need to do this because I have a large number to create and the actual number is variable and unknown.

Instead of manually writing a large number of line like

(setq var1 value1)
(setq var2 value2) etc

I used to be able to put 1 line in a loop to create and assign a large number of variables. I remember that it involved the use of the set (not setq) and read functions.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating An Export Command?

Feb 11, 2013

I am attempting to create a export command for our surveyors that deletes all there point layers and seal layer, then audits and saves the file before opening the etransmit command.

Below is what I currently have.I know there is a better way to do this, but it is above my programing skill right now.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SURVey export(defun C:SRVY () (command "-laydel" ; Delete Survey data "Name" "F0" "Name" "F1" "Name" "F2" "Name" "F3" "Name" "F4" "Name" "F5" "Name" "F6" "Name" "F7" "Name" "F8" "Name" "F9" "Name" "F10" "Name" "F11" "Name" "F99" "Name" "SHEET-SEAL" ENTER "YES" ) (command ".audit" "y") ; Audits file (command "_qsave") ; Save changes (command "-etransmit" "Choose Setup" "ACAD2010" "Create transmittal package" ) (princ))

AutoCAD Civil 3D 2012 (Primary), 2011 by contract.

Dell Percision T3500: MS Windows 7 64-bit SP1; Intel Xeon CPU W3505 @ 2.53GHz, 12.00 GB RAM, NVIDIA Quadro 600

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Hatch Pattern

Nov 4, 2012

i'm newbie in customizing tools in autocad especially in creating hatch pattern. i understand that to create new hatch pattern is by adding a new hatch pattern in acad.pat file with specific angle.

my question is is it posibble to create a hatch pattern that can use specific angle follows the object shape?

This is what autocad can do by default this is what i'm trying to create

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Object Using Entmake

Nov 12, 2013

I am creating a line using entmake, but I need the start and end point to be variable that was already defined  ex.

(entmake '((0 . "LINE")(8 . "FIELD") (10 . line_insert) (11 line_end)))

Command: !line_insert
(29.2813 20.5 0.0)

Command: !line_end
(29.2813 18.5 0.0)

The error I get is

; error: bad DXF group: (10 LINE_INSERT)

What do I do to make it recognize this variable?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Formula In Block?

Oct 24, 2012

I've been fighting with building a formula in a block utilizing a field from another block. I have a support steel member that once placed, will be lengthened. I need a distance from center of the pipe to the top of concrete. I created a block with a field referencing the insertion point (center of pipe) it works fine giving me this elevation. I also have another block that is the datum node. I have several fields in this block, and it is located at the bottom of the support steel plate. I am trying to create a field that takes the center of pipe elevation and subtracts the datum node elevation to get a distance. I created the formula referencing the COP elevation field and the elevation of the datum node. The information shows properly where I am building the formula, when I click evaluate, the Preview gives me ##### and when I create the datum node block that is also the output I get. I can't figure out why it won't give me the difference between the two elevation fields. I don't know what I can do differently to have that information in the datum node.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating New Drawing With Specific Template

Sep 20, 2013

I have some code that starts a new drawing with a specific template from a lisp routine

(defun ghd:load_newdwg (template / ae-acad-object newdwg)
  (setq ae-acad-object (vlax-get-acad-object))
  (setq newdwg (vla-add (vla-get-documents ae-acad-object) template))
  (vla-put-activedocument ae-acad-object newdwg)
)

The template location and file is stored in variable clienttemplate (and is not the standard template path set under options). All works okay except if I close the new drawing, when I return to the previous drawing that was current when the new drawing was created (i.e. the drawing that the routine was run from). I get the following error:

Command: ; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Unknown exception occurred
; warning: unwind skipped on unknown exception

I assume this has something to do with the original routine not closing/finishing before switching to the new drawing. This is the last line of the routine:

(cond ((= startnewdwg 1) (ghd:load_newdwg clienttemplate)))

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Menus In Command Prompt?

Nov 22, 2011

I am able in lisp to create a command prompt selection menu, easy (see code below).However what I want is for the lisp to be ready to undertake an action UNLESS I select an option.

An example is the offset command wich has a function ready to roll (namely the specify offset distance) "OR" I can interrupt the "specify offset distance" and enter one of the sub options (in the case of offset Through/ Erase/Layer).

My code attempts to offset also, UNLESS the user wishes to specify a distance.
 
(DEFUN C:loadoffset ();CREATING MENU FOR SUB COMMANDS [GETIT] [GOTIT]...(setq choose (getstring "
Select an option... [1=GET DIST] [2=GOTDIST]: "))(if (or (equal choose "1"))(GETIT))(if (or (equal choose "2"))(GOTIT));TERMINATING SELECTION MENU...)(defun getit ( gotit )(setq MYDIST (getdist "
SELECT A DISTANCE: "))(gotit))(defun gotit ()(command "_offset" MYDIST pause pause"exit"))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Array Using Split Function?

Jan 10, 2013

In asp I'd write:

arrFileName = Split(DrawingName, "_")

JobNumber = arrFileName(0)
DrawingTitle = arrFileName(1)

SheetNumber = arrFileName(2)

I'd like to do the same thing in lsp. I don't want to be limited to three fields so the split function is perfect.Is there an equivalent?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Two Closed Polylines From One Shape

Jan 4, 2012

I have a series of boxes or polygones that I would like the program to find the 1/2 distance and create two seperate polylines from the one object. 

Example: 

I have a square with pt1,pt2, pt3 and pt4 respectively.  After I have ran the program it would create a diagonal from pt1 to pt3 and join the rest of the lines now to create the one polyline. Also it would do the same to create another exact polygonal shape for the other half. Thus creating two shapes of equal value from one.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating A PDF And Putting It Into The Windows Desktop?

Dec 2, 2011

cannot find a way to create a pdf and saving it into a desktop.  Basically, in the -plot command, there should be an option to allow it to save to C:documents and settings"username"desktopfilename.pdf"

See the command line used:

(COMMAND "-PLOT" "Y" "" "DWG to PDF.pc3" "30 x 42" "Inches" "Landscape" "No" "Extents" "1=1" "CENTER" "Yes" "Fullsize.ctb" "yes" "No" "No" "No" "C:\Documents and Settings\Username\Desktop\Filename.pdf" "N" "Y")

The objective is to allow the lisp to plug in whichever username and automatically creating a pdf based on the filename.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Trigger That Is Stored In DWG File

Aug 21, 2012

What I need is a trigger saved within a drawing dwg file which if found will launch a lisp to run if the trigger is not present in the dwg the lisp will not run.

If memory serves me correctly the trigger was managed by creating a unique table search item saved in the actual dwg file. A start-up lisp would then search for it and if found it would run the lisp if not it would simply continue as if nothing happened.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating A Script To Run Multiple Routines?

Apr 17, 2012

I have hundreds of drawings I want to run through scriptpro with a script calling 3 different lisp routines.  I have the 3 lisps working independantly but can't figure out how to get them to all run in one script.

Two of the Lisps are for redefining the title block in 2 different types of drawings that have different title blocks.  The last lisp locks all viewports in all windows.  I'll attach the 3 lisps I'm trying to merge in the script.  I am not very versed in scripts and lisps so I'm guessing at least 2 of these lisps could be merged into a single lisp...

Here is what I have for the script file contents (which doesn't work):

(load "redefine100")

(load "redefine102")

(load "vlocker")

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Solid Rectangle Shape File

Sep 8, 2011

I want to create a custom linetype that uses a solid rectangle 0.5wide and 1.0 long.  Basically I want to create a shape file from an existing block I have so that I can insert it into the linetype definition.  Is there an easy way to do this in ACAD 2009?

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating And Modifying MESH (SubDSurface) Entities?

Dec 25, 2012

I have uploaded the handout for my AU2012 class to Google Drive. The link is [URL] It contains the detailed explanation for all the source code used in entmake-ing and entmod-ing the new MESH (aka Subdivision Surfaces) entities. [URL]

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Stacked Fractions For Dimension Override

Sep 30, 2011

I wrote the code below (allow the user to pick points in different viewports and then override an existing dimension's text with the difference in X values.  The (hopefully) last issue is that the fractions should be vertically stacked and at 100% text size. 

(defun c2text ()
(command "mspace")  
(setq p1 (getpoint "Select left point "))

[Code]....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Routine Or Script To Change Pen Weights

Apr 26, 2013

Creating either a Lisp or a script to change the pen weights of two layer in autocad 2011?

View 9 Replies View Related







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