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


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Divide One Radio Column Into Two Radio Columns?

Dec 16, 2013

I want to take a Radio Column with 10 Items and make two columns of 5 Items, so that onlu one of the ten radio buttons are selected. This is aide in spacing on the Dialog Box. I am trying not to re-write the whole program, just add a few options.

I tried to add another Radio_column, it seperates it, but its two separate sections.

:radio_column {label = "Side Elevation";
fixed_width = true;
fixed_height = true;

[Code]....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: DCL Radio Button Label Length

Jun 28, 2013

I am trying to revise an old dialog box so that I can add some new options but I'm finding it difficult to shorten the label for a radio button enough to get the box width to look reasonable. I read somewhere that Windows fonts cause the label lengths to hold extra space for each character. The webpage that I found this on said the solution was to make a new line for the label, which sounded great to me, but they did not tell how to do it. After much searching, I figured out how to add an additional line to the label, but my program now refuses to function correctly. I set the middle button before initiating the dialog in my lisp, but when I select a different option, the original button remains selected along with the user's choice. The program actually works, using the last button selected, but I really want the button to respect the pick by the user and deselect the default button.

This worked perfectly when I had only two selections, and it still worked perfectly when I added the third option, but it just doesn't like it when I try to add a new line for the long description in the middle of a radio column.

I'm barely functional with dialog boxes..

DCL in question:
:boxed_radio_column { label = "Location"; width = 20; height = 2; fixed_width = true; fixed_height = true; alignment = top; :radio_button{key = "sl-AD"; label = "Spring Lake Applications";} :text_part{label = " and Distributor Services";} :radio_button{key = "sl-BP"; label = "Spring Lake BP Systems";} :radio_button{key = "gr"; label = "Grand Rapids";} }
 
lisp has the following in this order:

load dialog - I have a loading function that works fine
(set_tile"sl-BP""1")
(action_tile"sl-AD"           "(TGW-Setup_01 $key)")
(action_tile"sl-BP"           "(TGW-Setup_01 $key)")
[Code] .....

Of course, these are just the pertinent sections of a much larger setup dialog, but I didn't think I needed to post all the functions that this program is doing, since you'd have a difficult time running this without my templates, printers and a number of support files.

Like I said, it seems to be choking on my adding :text_part {  Label = "      and Distributor Services";} instead of making this a single line of the label for the button above it.

Why does this cause the default radio button to stop releasing?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Radio Cluster To Select Next Dialog Box

Feb 20, 2012

I'm trying to set up a main dialog box with three radio buttons.  the selected button will determine which 'next' dialog box appears when the next button is clicked.  
 
(defun c:steel (/ dcl_id) (setq dcl_id (load_dialog "steel.dcl")) (if (not (new_dialog "steel" dcl_id)) (exit) ) (action_tile "angle" "(setq shape "angle")") (action_tile "beam" "(setq shape "beam")") (action_tile "channel" "(setq shape "channel")") (action_tile "accept" (cond ((= shape "angle")(c:angle)) ((= shape "beam")(c:beam)) ((= shape "channel")(c:channel)) ) ) (start_dialog) (unload_dialog dcl_id) (princ))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Update Radio Button Default Values In Dialog Box?

Apr 3, 2012

Rudimentary lisp & dialog box skillls here...

I have a little dialog box with seven radio buttons and a text box that generically accomplishes what it's supposed to do. To retain the current dialog values, I use the write-lline function to store the information and then use read-line to bring that information back in for other Lisps that I use. As long as the user doesn't open the dialog, whatever options were last selected will remain in effect.

However, if the user re-opens the dialog, then whatever defaults I have initially set up in the dialog will then become active (in other words, whichever of the radio buttons I have set to "1")

My question is whether or not I can have the dialog box set up so that if a user selects an alternate radio button, that radio button will keeo it's value whether or not the dialog is opened and until and if the user changes it..

As it is now, whenever the user opens the dialog box to change, say one radio button, the user then has to change the other radio buttons if the defaults don't match the current run requirements.

Here's the dialog and the lisp:

OPTIONS : dialog {
label = "   Counter to Cad Options";          
: spacer {
height = 0.75;

[Code] ......

View 3 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 :: Custom Buttons With Script-like Functionality

May 18, 2012

I would like to build a custom button that mimics the FDO - Save as AutoCAD drawing functionality. Clicking this button brings up a wizard with too many clicks for how often the users will do it.

They will not want to load a script so a custom button is required. Also, I need to be able to dynamically set the new saved file name based on the source DWG file name.

View 1 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 :: 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 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 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 :: 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 :: 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 :: Continuous Dimension Lisp That Alternate Its Position

Jul 12, 2012

Is there a lisp that will allow me to do a continuous dimension, but will alternate the dimension position from low, high, low and high?  If there is no lisp already created, how to create one? 

See Continuous dimension attachment for example.

I work at a glass and glazing company and this is how we dimension mullion width and DLO. See typical window dimensioning attachment for window elevation with dimensions.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add String To Each Item In List Using Lisp

Nov 14, 2013

I have a list ("temp.dwg" "temp2.dwg") and would like to add the string "insert text here" into each item in the list resulting in ("insert text heretemp.dwg" "insert textheretemp2.dwg").  how would i go about doing that using LISP?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Opening Drawings With Default Visual Style Set To 2D Wireframe

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

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 :: Visual Effect Settings?

Jun 20, 2013

Lisp that switches back on Selection Preview i.e. thickens and highlights lines when you hover over them?I don't know why, but they are always unticking the boxes.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Combinations In DCL?

Sep 7, 2012

Is it possible to execute a certain command based on multiple selections withinin a dcl?  for example:  two radio colums, one with selections A and B, and a second with selections 1 and 2.  is it possible to program commands based on user selections from each column?  ex: if A and 1- do a command.  A 2- do a different command, etc...

I tried :

 (action_tile "key1" "(setq A t")
 (action_tile "key2" "(setq B t")

 (action_tile "key3" "(setq 1 t)(done_dialog)")
 (action_tile "key4" "(setq 2 t)(done_dialog)")

(if
(and (a) (1)
)
(command ...

but was unsuccessful.  no matter which combination was selected, the command under all combinations would run.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Attribute Value

Jun 3, 2013

I am trying to find a lisp that would get an attribute value (tag name = NBR_5) . I'm trying to run a simple routine that would let the user place the value from the titleblock attribute as text on a drawing. I see a ton of articles regarding getting attributes but I am not well versed in programming.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Nil At The End Of Command

Jun 22, 2012

I have a routine that work fine, but I receive a nil at the end of command. How to fix that?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: 3D Point From X And Y?

Oct 9, 2013

I'm trying to find acceptable point values to feed to the vlax-3d-point function for a vla-addmtext function. With vanilla lisp I just provide the point as x y = "7/32" "2-3/8". So I assumed that I could drop a 0 in for the z like: (VLAX-3D-POINT "7/32" "2-3/8" 0).

Then I thought I was going to be tricksy and try (vlax-3D-point (getpoint)) believing that I could pick the point and get what I need to feed the function, but yet again, no deal. The command line gave me: 

node
of #<variant 8197 ...>

Nothing I can use in my code. So how do I find the point in a format that vlax-3d-point will like?

View 9 Replies View Related







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