AutoCAD Visual LISP / AutoLISP :: Function For SELECTED ALL Object In Drawing?

Jun 3, 2013

How to make a lisp command that will select all objects in the drawing?

View 3 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Function To Print Out Entire List Of Selected Entity?

Oct 28, 2011

I am looking for a function to print out the entire entity list of the selected entity...

so... walking down through the entity data... print out what it finds... any time it encounters an entity name... then do an entget and print that out too.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Object Reactor And Load Function LSP

Mar 13, 2012

I open the drawing without loading the function, when I modify an object with the reactors appears the following error message:

function definition: NAMEFUNCTION

You can avoid this annoying message without removing the persistent reactors? 

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Move The Selected Object Using ObjectDBX

Aug 7, 2013

Using Nentsel function, I can get info on a object that is nested with an Xref. Is there a way to move the selected object using ObjectDBX?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Vplayer Color Of A Selected Object

Sep 9, 2011

I thought this would be a simple tblsearch process, but as far as I can tell, there isn't a tblsearch symbol table for vplayer settings, so I need to get more creative I guess.

I want to be able to get the vplayer color of a selected object as part of a larger routine I'm putting together.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Selected Object Is In XRef To Highlight

Aug 15, 2013

I think there is a function that will cause the selected object that is in the XRef to highlight.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Removing Last Characters Of Block Name In Selected Object?

Jul 29, 2013

When i export revit drawing with revit family 

the revit family become block in autocad like this

M_Single-Flush - 700 x 2200mm-278353-Ground Level _0_45

usually i want to remove the ID and view name to become like this without have to re type because it is tedious

M_Single-Flush - 700 x 2200mm

something like how many letters you want to remove from last to first ?

or something better like remove this last two dash and the letters embedded inside ( that separate name-ID-View name)  -278353-Ground Level _0_45?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Determine Type Of Object That User Selected?

Mar 1, 2012

Is there a way to determine the type of ACAD object that the user selected? I need to retrieve the value from either a dimension or text. The info could be in either format so the lisp routine needs to determine what was selected so the correct vla-get command is used.

Once I determine what the object is I can use an if statement to retrieve the value.

;user selects the object
(setq dimobj (vlax-ename->vla-object(car(entsel))))
;If ACAD object is a dimension do this.
(setq dimvalue (vla-get-textoverride dimobj))
;If ACAD object is text do this.
(setq dimvalue (vla-get-textstring dimobj))

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Total Length Of Selected Object And Summarize Them A Table

Jan 4, 2014

I need a lisp file that can read the total length of selected object (lignes, polylines) and summarize them by layers or by color in a table

e.g

command:tl (total length)
select objects
found total length.......
select object (Ent)
total length or [Add/Subtract/Table] :
total length = .......
if table
Enter an option by [ Layer/Color/line Type/line Weight] <layer> :

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Larger Routine To Create And Rotate Text Based On Object Selected

Dec 29, 2011

the expression in question is part of larger lisp routine to create and rotate text based on the object selected and the viewtwist variable (we use dview twist to rotate our views when needed)

So the expression in question:
(< (/ pi 2) ang (* pi 1.5)
where ang is the total angle used to determine proper rotation of the text.

Now the problem. In most cases where ang = 90 (or 1.5708 radians) this works fine. the two exceptions i have encountered

in testing are a line at 70 degress, viewtwist 20, and line at 50, viewtwist 40. For whatever reason at these two conditions the expressoin evaulates True instead of nil and rotates the entire text object incorrectly (180 degrees). So question is how exactly is this being evaluated? i know its comparing ang (* pi 1.5) to (/ pi 2). is there some sort of rounding error? or maybe the expression needs a wee bit more definition? attached image and full lisp routine for reference of what is happening, blue text is angle of the line as created by routine at viewtwist 0.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: No Function Definition With Distance Function

Oct 25, 2013

This seems absolutly silly.

(setq p1 (getpoint))
(setq p2 (getpoint))

(setq Dist (distance p1 p2))

Why does this not work?

I'm trying to build a command to replace AutoCAD's "DI" command, to give distance and delta x, y, and z values in decimal and imperial, and keep the angles in XY plane and out of XY plane.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Set Function To Radio Buttons

May 7, 2013

simple example code how can i set my lisp function to radio button ?

i found simple dcl - lisp codes , there is possibility for calling simple cad commands , but this is different about call lisp with buttons

which code i have to change and how  for set my lisp on radio buttons ..

here is the sample codes ...

SAMPLE1 : dialog {           label = "Sample Dialog Box Routine - Part 1";           : column {             : boxed_column {               : button {                 key = "but1";                 label = "Button 1";     

[Code].....

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Expire Date For A Function

Nov 27, 2012

I want to define en expiration date in registry, after that date the some LISP programs does not allow to run. I think that suitable commands are SetEnv and GetEnv.

define a ExpDt variable that contains Expiry Date as a string. And add some statements inside of the LISP program to call this variable and check it with today's date.

I should define once time in autocad:

(setenv "expdt" "130101"); YYMMDD date for validation period (2013.01.01)

and check this every time that a lisp program should be execeute:

(getenv "expdt") ; if today's date(with YYMMDD format) ">" expdt then lisp program doen not allow to run and should be halted.

for e.g. on 2013.02.28: "130228" > "130101" ==> so the lisp function should be halted and will not work!

(without any alert or message)

a sample list function: (how can implement on this lisp function?)

(defun c:3()
(setq w t)
(while w
(setq a (getpoint "
pick point:"))
(setq p1 (list (- (car a) 0.5)(- (cadr a) 0.5)))
(setq p2 (list (+(car a) 0.5)(+(cadr a) 0.5)))
(command "erase" "w" p1 p2 "")
(command "INSERT" "*3" a "" "" "0")
)
(if (= a nil)(setq w nil))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Math In Foreach Function

May 15, 2013

In the foreach function can you use math like (foreach pt1 (add 1) so that foreach one you pick it adds one the next one will be named pt2 then pt3 and so on.

View 6 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 :: Compiled Function Definition Error

Aug 17, 2012

The error below has appeared randomly when AutoCAD 2011 is started.  There was not an error of this sort, but it suddenly appeared and some of the LISP routines will no longer work. 

*Invalid attempt to access

a compiled function definition.  You may want to define it using defun-q:

#<SUBR @000000003f5fda98 S:: STARTUP>

View 1 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 :: How To Define A Function With Negligible Arguments

Jun 25, 2013

I prepared a code to calculate number of days between two date.

I want to know how can I define negligible arguments for my lisp routins. It means if I omitted the arguments, lisp code can handle it without any errors ("; error: too few arguments")

In this case, my program defined as:  (TotalDays 1st_date 2nd_date)

(TotalDays 1978 03 21 2013 06 25)

and I want to have flexibility: if I use this routine as (TotalDays 1978 03 21), the program should substitute today's date with second date.

I know if I put "nil" instead of date for 2nd_date, It will not be an error, because:

(if (and y2 m2 d2) (setq n2 (GetJDN y2 m2 d2))(setq n2 (fix (getvar "DATE"))))

but that's not my favourite!, how can I omitted 2nd_date completely? as (TotalDays 1978 03 21)

Here is my lisp

;|How to use:(TotalDays 1978 03 21 2013 06 25)|;;;;;By Abbas Aqdam(defun TotalDays ( y1 m1 d1 y2 m2 d2 / n1 n2)(setq n1 (GetJDN y1 m1 d1))(if (and y2 m2 d2) (setq n2 (GetJDN y2 m2 d2))(setq n2 (fix (getvar "DATE"))))(abs(- n1 n2)));;;;Leap years are included;;;;By Abbas Aqdam(defun GetJDN ( year month day / a y m J)(setq a (/(- 14 Month) 12))(setq y (-(+ year 4800) a))(setq m (-(+ Month (* 12 a)) 3))(setq J (-(+ day (/(+(* 153 m) 2)5) (* 365 y) (/ y 4) (/ y 400)) (/ y 100) 32045)))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: STRNUM Error - No Function Definition

Jan 10, 2012

I D/L a lisp file (setvars.lsp) that purports to give a list of system variables that match a short string entered in a dialog box.

Unfortunately, an error arises that says 'error : no function definition: STRNUM'

I've looked at the code and can't tell what the writer was hoping to achieve.

The specific section is as follows:

    (if F1
      (progn
        (setq RL (read-line F1))
        (while RL
          (if (and (wcmatch (strcase RL) (strcase (strcat "*" DESCR1 "*")))
                   (wcmatch (strcase RL) (strcase (strcat "*" DESCR2 "*")))
[Code] .........

There is no other mention of STRNUM in the whole of the lisp.

There is an accompanying setvars.dat, wherein apparently, the writer compiled a data file of all the system variables in AutoCAD2008, each variable being followed by an '=' and then a description of the variable.

If necessary I can post the whole lisp and dat file, but was hoping to discover the intention from the above extract and therfore where I might work out an alternative to this line.

Looking to turn a string to a real? If so, why are there two 'arguments' following the 'function' STRNUM?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Upgrade Function To Grab Multiple Blocks?

Jan 23, 2012

I was able to find/update a LISP program that returns the dynamic block to its original state, overriding the anonymous name and make the actual block name the effective name. I am in the process of manipulating the LISP program so I can select multiple blocks rather than one at a time.

(defun CYMEFFEC ()(vl-load-com) (setq obj (vlax-ename->vla-object (car (entsel "Select blocks: ")))) (vlax-put obj 'Name (vlax-get obj 'Effectivename)))

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Block In A Specific Layout Using Function

Jan 28, 2012

I would like to insert a block in a specific layout (eg. "LAYOUT13") using the function vla-insertblock

I have already searched the web and this newsgroup but have not found the solution.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Commands Not Finishing After Calling Script Within Function

Nov 15, 2013

I have a simple lisp function to add a scale axis to a drawing by calling a script, renamed the drawing by appending "withScale" to the file name, and then closing the file. I placed a call to the function in the acad.lsp file in the startup suite. The idea was to batch process all files by simply opening them. Upon open the startup acad.lsp file runs, which calls my lisp function, which in turn calls the scale script. It should then execute the renaming, saving, and closing commands. The problem is that it is calling the script fine and renaming the file, but it does not save the changes before closing. Here is the lisp function
 
(defun saveScale(); (command "-purge" "all" "" "n")(if (findfile "C:/Users/Russell/Desktop/TreeFiles/Automation/Scale&Key.scr")(command "_script" "C:/Users/Russell/Desktop/TreeFiles/Automation/Scale&Key.scr")); end if (command "_.zoom" "e") (command "_saveas" "2013" (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "withScale.dwg")) (command "close") ) (saveScale)
 
Apparently you cannont run any lisp commands after calling a script, however the renaming still follows through.

I've attached the script file as well. (I couldn't attach .scr format so you may need to rename it).

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Selected Text(s) To CSV Files

Nov 14, 2012

I need a LISP program that prompts: "select text(s)" then I select for example 100 text in open drawing file.

after that this program creat a file (LIST.CSV) and write each selected text in line by line of this file:

result text file (LIST.CSV ) should be:

Text1

Text2

Text3

...

...

Text99

Text100

 ofcourse Text1 is the content of a text object.

View 9 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 :: 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 :: Passing A List Of Points To Function Instead Of User Input

Sep 16, 2013

I have a list function that asks for the user to pick points when it is run. It looks something like this (foo arg1 arg2) When invoked it asks the user to pick points and press enter when done It.

Instead of getting the points from the user i want to pass it a list of pre-defined points. The code cannot be changed so I must use it as is.Is this possible, if so how can it be done?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Return To Calling Function After Trapping Error In Subroutine

Mar 13, 2012

I've got a subroutine that gets the centroid of a closed polygon (lwpoly).  It appears to fail if the polygon has any zero length line segments.  I've added a trap that catches the error and "highlights" the offending polygon, but it stops there and does not return to the main function that called the subroutine.  Is there a way to get back to the main function from the trap?

Here's the subroutine (original function by _gile (Autodesk LISP Forum 9-18-2006):

(defun return-centroid (lwpoly space / obj Region Centroid)
(setq *error* trap1)
(setq obj (vlax-ename->vla-object lwpoly))
(setq Region (vlax-invoke space 'addRegion (list obj)))
(setq Centroid (trans (vlax-get (car Region) 'Centroid) 1 0))
(vla-delete (car Region))

[code]....

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Prompt Text / Mtext Not Selected

Nov 13, 2012

I’m trying to put together a loop for if nil or something other than text or mtext is accidentally selected than prompt text was not selected. This is what I have so far.

text or mtext is not selected than prompt

(defun C:ww ()
(while
(not
(and
(setq esel (entsel "
[Code]......

View 7 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

AutoCAD Visual LISP / AutoLISP :: Show Difference In Selected Text?

Jan 17, 2013

I have a little routine to add two selected numerical texts together and show the result at a selected position. I am using the entsel method to select them. I would like a way to highlight the selected text temporarily. Is this possible. The routine is as follows.

(defun c:T+ ( / Txt1 Txt2 Txt3 Pkt )
 ;Adds second selected number to first
 (setvar "dimzin" 3)
 (setq curlay (getvar "clayer"))
 (setq curcol (getvar "cecolor"))
 (setq curlin (getvar "celtype"))
 (setq ds (getvar "dimscale"))

[code]....

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add Attribute To Selected Blocks (XY Coordinates)

Nov 30, 2012

i have found the following lisp in a previous thread: (shows XY coordinates of the selected blocks)

(defun C:MyFunc (/ ss Index Ename Lst)
(while (or (not ss) (= 0 (sslength ss))) (setq ss (ssget '((0 .
"INSERT")))))
(if ss

[Code]....

I want this information to be added to the blocks as hidden attributes so that i can extract them by attout. The work to be done is : attout to excel, autofill an attribute (numbering) then attin.

but my problem is that i cant think of a way to number those blocks IN ORDER (ie top to bottom or left to right) unless by sorting them in excel first by their x or y coordinates

View 9 Replies View Related







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