AutoCAD Visual LISP / AutoLISP :: How To Retrieve Today Date
Jul 17, 2012How can i Retrieve today date through Lisp.
View 2 RepliesHow can i Retrieve today date through Lisp.
View 2 RepliesHow can i retrieve the layer states via lisp.
View 3 Replies View RelatedI try to use the SSGET function, and it returnes a string.
How to access the data?
Which function to use?
Here's my situation:
I have a block named "WIDGET-A". And in that block are (4) attribute tags whose names are:
"ID"
"TAG01"
"TAG02"
"TAG03"
The user will be prompted to pick the value displayed at any of the "TAG##" attributes - they will select the attribute tag they want (we don't know which one it is, we just want to assign that value of the attribute tag they clicked on to a variable called "VAR2".
Now, what we also want AutoCAD to evaluate, behind the scenes, is the value of the attribute tag named "ID" which we know always exists in the block and then assign that value to a variable called "VAR1".
Is there a way for AutoCAD to do this all from only a single user pick on top of an attribute value, in a block whose name isn't always going to be 'WIDGET-A' either.... But the block, whatever it's name, will always have the attribute tag "ID" with a value in it, and we always want to capture the value of whatever attribute tag within the block that the user clicked on.
Is there any way to retrieve the arc length from Revision cloud and how can we identify that object is a Revision Cloud.
View 9 Replies View RelatedWhen we launch the list command, the Area system variable holds the area value of the selected shape.
How to get the length value into an Autolisp program to use it?
I would like to be able to retreive data from a sepcified cell, in a specified worksheet, from an excel file.
I don't have any clue how to connect to an excel file and read the data. Most seems to think you already had an understanding but I'm starting from the beginning.
is it possible to retrieve the names of all the nested external references, and how should it be done?
View 2 Replies View RelatedUsing (setq Filetab (vla-get-files (vla-get-preferences (vlax-get-acad-object))))(vlax-dump-object Filetab) returns most pathname as specified under Options. However, the Action Recorder path is missing. How do I retrieve this path?
View 1 Replies View RelatedI 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))
)
I'm using Autocrat 2004.
I have a attributed titleblock. Sometime in the future I will need to change the date attribute to another value, i.e.. 7-11 to 9-11.
I can't place a text string in the title block because this title block is used for multiple drawings and the date will be different for different sets. I can't have numerous title blocks because of the client's requirements.
Question:
Is there a way to write a script to open a drawing, look for the specific attribute, change the date value, save and close the drawing - across multiple sheets? Would a lisp routine called by the script be able to do this? Or a script file called by the original script file? CAn you even use a script file in this manner?
I posted a version of the Offset command that lets you Undo individual Offsets and change the offset distance/Through option, without getting out of the command, at Cadalyst CAD Tips: URL....
It's an upgraded version of an earlier concept by Gopal Ramesh. It's been downloaded almost three times every day since it went up, so I guess people expect it will be useful.
But the website's description includes: "this routine does not provide access to the Layer or Erase options of the built-in Offset command." The reason for that is that I'm working back in 2004, so those options are not present for me to emulate. [The Undo option in the routine is one that was added in some later version, but is a very useful enhancement for people using older versions, like me.]
I do also have an Offset-to-any-Layer [not just the source's or the current Layer] routine posted there: URL....
And I have a simple little routine to Offset something and Erase the source object. So I think I have all the "pieces" to include those options that newer versions have, but that I don't. I would like to combine the functionalities into the Offset-with-running-options routine. That way, if people want to use it to redefine the Offset command as I have done, in order to get the while-running distance change option, those working in newer versions won't be losing the Erase and Layer options in the process, and those in older versions will be gaining yet more options.
how to append I’m assuming its not write-line but append line. And also I’m having trouble recording the date variable… I keep getting error bad argument type stringp nil
; Appends usage count by DATE long variable...(setq g(open "C:/ICT/AutoCAD_Architecture_suite_2012/CUSTOM/WOOD Clones/PEN/USSAGELOG.PEN" "w"))(setq MYDATE DATE)(write-line MYDATE g); AS ABSOLUTE LAST WE NEED TO CLOSE THE TEXTFILE...(close g)
I have the following code snippet I’m trying to append the file named USAGELOG.TXT to record the date of executions
I am aware of the plot stamp available in the Plot Dialog box, however, we are looking at ways to imbed this info in the dwg. I currently have the WD_TB with an attribute for FULLFILENAME, an attribute for PLOT DATE, and an attribute for PLOT TIME12. So I get the information on the dwg. I would like to be able to run all these attributes as a string. I have tried FULLFILENAME|PLOT DATE|PLOT TIME12 with spaces, commas, ( ), " ", etc. and I do not know the proper syntax to get this to work. I have also tried (getenv "FULLFILENAME") or the getvar, in the title descriptions box.
View 1 Replies View RelatedIs 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.
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 RelatedIs 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)
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:-
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 RelatedIs 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.
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 RelatedI have a routine that work fine, but I receive a nil at the end of command. How to fix that?
View 7 Replies View RelatedI'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?
What is the magic word for put a point at each end of an arc, the lisp I have only put a point at center of the arc.
(defun cAA ( / i j ss e1 e2 p1 p2 p3 points )
(if (setq i -1 ss (ssget '((0 . "ARC"))))
(progn
[Code].....
Is there a quick way of getting the value of an attribute?
I have an attributed block called "tp_attributes" and it has and attribute called "OrderNum".
I just want to be able to quickly grab that value.
I use Spell Check regularly and I always check the entire drawing. I would like to add to the Spell macro so that when I pick Spell from the toolbar it goes past the Check Spelling window and begins checking the entire drawing.
I believe I need to insert Alt S into my macro to select Start from the window to begin the check. Is there a character or series of characters that will represent Alt in a macro?
I upgraded from Autocad 2004 to 2012 recently and my lisp file doesnt work anymore.
what it's supposed to do is when looking at the layout tab that you want you can switch to the model space location of the same zoom as the layout tab without messing with the layout zoom.
(defun c:msp ()
(setq cm (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command"view" "d" "tmp")
(setvar "tilemode" 0)
(command"pspace")
(princ "Click TWICE on desired VPORT: ")
(command "mspace" pause "view" "s" "tmp")(princ)
(setvar "tilemode" 1)
(command "view" "r" "tmp")
(setvar"cmdecho" cm)
(princ)
)
I need a program that simulate this DOS command: dir /on/b *.dwg >list.txt
it list all dwg files on current open dwg file folder and sort them and finally put them in a text file with list.txt name. something like thistype list.txt)
test1.dwg
test2.dwg
test100.dwg
test256.dwg
test1005.dwg
(sort alphabetically and logically) because of disabled DOS utility in my PC I need a pure lisp functions, I tried to wrote this program but I couldn't!!
(defun c:listMaker()
(vl-load-com)
(setq path (getvar "dwgprefix"))
(setq fn "list.txt")
[code]...
and also I need a append a string(='This Is EOF') in the last line of the "list.txt" file.
I have text objects with the same Z value and I will select as follows:
(setq sstxt (ssget '((0 . "TEXT")(8 . "APS-text"))))
How to store this value in another variable "zvalue" to apply to:
(command "change" "select text objects" "" "_p" "_e" zvalue "") ?
the following returns true since the @ symbol tests for an alpha character.. (wcmatch "S101" "@*").What is the Dot Net equivalent?
View 2 Replies View RelatedIs there a command that is the opposite of starting an application to open up a file? Like:
(startapp "PlaySound.exe" (findfile "CuckooClock.wav"))
Instead of starting an application, how to shut all of its instances down. Let’s say I have iTunes and/or Internet Explorer w/ a few tabs open and I can close them down without getting to the application to terminate it the usual way.
Naturally,
(endapp "iTunes.exe") doesn’t work :-))