AutoCAD Visual LISP / AutoLISP :: How To Get Net Volume Results Into Variable
Nov 11, 2011
There is a command in autocad that will get a Bounded Volume from a closed polyline and a volume surface (command "AeccReportSurfBoundedVolume"). It reports the results to the screen. How to get the "Net Volume" results in to a variable using Lisp?
Maybe a lisp routine that gets information from the text screen. That would not be ideal but I could work with that.
View 2 Replies
ADVERTISEMENT
Jun 3, 2013
I wrote a lisp, that grabs all text and assigns it a variable. Here's what it looks like:
(setq numbers (ssget "_X" (list (cons 0 "TEXT") (cons 1 "*")) ))
(sslength numbers)
(setq numb1(ssname numbers 0))
(setq enlist1 (entget numb1))
(setq texty (fix (caddr(assoc 10 enlist1))))
(setq value1 (cdr(assoc 1 enlist1)))
In this case length returns a value of 20. I can repeat this command 20 times and have all these variables but I don't think that is the best way. I do need the "y" value insertion point of the text. Line numbers are very important with what I do.In the end what I want to do is
1. sort through how ever many values sslength returns.
2. compare a blocks attribute "y" value insertion point with that of all the text values.
3. If both y values are equal then that blocks "tag name" will be changed.
Here is what I am doing on the block end with for reference:
(if (= texty fuwhole)
(setq funum1 (subst (cons 1 (strcat "FU" value1)) (assoc 1 funum1) funum1))
(entmod funum1)
)
fuwhole is the blocks "y" value insertion point.
funum1 is the blocks dxf group code
View 2 Replies
View Related
Aug 5, 2013
The lisp routine displays point values of a boundry (window) of an object using the vla_getBoundingBox.
The concept of the routine is to select any object and return two Point window value.
This routine works, but I noticed the Z point is changing depending on the object type drawn in 2d space elevation 0.0.
Test: Open a new drawing. Set the snap value to 1.0 just to make is easy to see values.
Draw three objects: A horizonal line, A Rectangle and Arc.
Load the gbb.lsp and run it, gbb
Select all three objects and notice the results.
It appears that objects the have an curve change the Z value (very little), but Z should be zero.
Try it with a polyline and then PEdit and FIT and re-check the Z value.
View 5 Replies
View Related
Dec 20, 2011
how to work with safearrays so that I can modify a dynamic block property reporting tool that I found here on the forums. I’d like to take the following code and filter out the extraneous properties so that the user doesn’t get information overload. Here’s the code that I'm starting with – works nicely:
(defun c:dbinfo (/ obj v vval sal salnth count)
(setq obj (vlax-ename->vla-object (car (entsel "
Select Dynamic Block: "))))
(setq v (vla-getdynamicblockproperties obj))
(setq vval (vlax-variant-value v))
[code]....
So, how do I filter the safearray list (down two levels to property names) so I can remove origins and other unimportant properties? Here’s the two property names I am trying to filter out:
(or (= (car y) "Origin") (= (substr (car y) 1 8) "Position"))
I’m beating my head against the wall trying to figure out how to take sal and redefine it like:
(/= (or (= (car y) "Origin") (= (substr (car y) 1 8) "Position")))
Of course, that doesn't work with a safearray.
View 6 Replies
View Related
Nov 15, 2013
I was just looking through one of Lee Mac's tutorials and I'm curious about something.
Here's a link to the tutorial I'm talking about.
[URL]
What is the purpose of the asterisks in the following code (marked in RED):
(if (not *ans*) (setq *ans* "Alpha"))
(initget "Alpha Beta Gamma")
(setq *ans*
(cond
(
(getkword
(strcat "
[code]....
View 4 Replies
View Related
Apr 23, 2013
I am trying to change the current TARGET variable to 0,0,0. If the variable is not changed is causes problems with plotting. I have the VBA that will change the TARGET variable. VBA works no problems. I am wanting to replicate in LISP because I do not want to have to convert to .NET and do not want to make sure the user has the VBA loded on thier system. Here is what have so far.
;;;Get active viewport
(setq avp (vla-get-ActiveViewport (vla-get-ActiveDocument (vlax-get-acad-object))))
;;;Get current TARGET variable
(setq CTarget(vla-get-Target avp))
Here is the problem. Is changing or putting the vaiable.I have tried
(vla-put-Target avp (vlax-3D-point '(0.0 0.0 0.0)))
and
(vla-put-Target avp (vlax-make-variant (vlax-3D-point '(0.0 0.0 0.0))(vlax-variant-type CTarget)))
They either error out or nil with no change. I have even tried to locate it in the Dictionaries.
View 5 Replies
View Related
Sep 17, 2013
I've created a list and want to subtract all the values within it from another variable, and assign it to a new variable. How do I do it?
Basically, I ask for ground level (assigned to variable G1), and then any number of depths beneath that (assign to list LVLLIST), and I want to return the value of the bottom point. So it's all the values in LVLLIST added together and subtracted from G1. And assign it to a new variable BASE.
For example,
G1 = 650.00
LVLLIST = (1.23 23.26 0.13 50.23)
(setq BASE (- G1 LVLLLIST))
View 2 Replies
View Related
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
Feb 28, 2012
Is there anyway to program variable names?
What I was thinking of was in a loop some times I need multiple sets of similar variables but am not sure how many sets I am going to need. I would like to be able to increment the variable names each time the loop runs.
View 2 Replies
View Related
Feb 7, 2013
Somehow, I manage to turn of one variable that display errors on command line.
For example:
(seq a 6)
suppose to return, on command line, something like:
error no function definition: SEQ
View 9 Replies
View Related
Oct 10, 2008
A2008. Is there a setvar, setenv, registry entry etc. that can be used to change the scale of Multileaders with annotative off to have the same effect that DIMSCALE has on Q leaders? I want to have a single scale-independent Multileader style and modify it on the fly along with DIMSCALE and LTSCALE. I'd use Qleader but UCS's do odd things to text position and orientation.
View 4 Replies
View Related
Jul 9, 2013
I would like to use a string as a variable if this is possible. I've got:
new-pl-lay (as a variable that holds layer name "UGL_PL_NEW")
first-cable (as a string that holds "new-pl-lay")
I'd like set the current layer to "UGL_PL_NEW" by using the first-cable string.
Something like:
(command "_.layer" "m" (read first-cable) "")
View 8 Replies
View Related
Mar 12, 2012
I am trying to shorten my code by using the variable as the command name. Is that possible to do?
;; instead of this(cond ((eq USER_INPUT_ANSWER "blk-cdtree-01-06")(C:blk-cdtree-01-06)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-08")(C:blk-cdtree-01-08)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-10")(C:blk-cdtree-01-10)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-12")(C:blk-cdtree-01-12)));; do something like this(C:blk-cdtree-(substr USER_INPUT_ANSWER 11))
View 8 Replies
View Related
Oct 20, 2011
how to write a lisp command, or function, that will save my newly created drawing with a file name is that is called up from a variable.
For example:
(setq filename variable)
(command "saveas" "r14" "filename")
and i would want the outcome to be: variable.dwg, rather than filename.dwg. I have tried numerous different ways of doing this with command prompt and cant seem to get anything to stick. Everything that works just creates a file named "filename.dwg", which is not what i want to do.
View 9 Replies
View Related
Oct 22, 2011
Run TIME command and then take the resulting text and save it to a file.
Ideally, the text file should be named based on the drawing name. I know there's ways to write text to a file but I haven't had any luck taking the output of a command and exporting it.
View 9 Replies
View Related
Nov 22, 2012
How do I check, with LISP, if a System Variable is read only? In particular ANNOTATIVEDWG. This one is read/write when there are no annotative objects in a drawing, but read-only if there are.
View 7 Replies
View Related
Oct 2, 2012
How come I can't modify the following registry key to the SAVEFILEPATH variable?
(vl-registry-write "HKEY_CLASSES_ROOT\SOFTWARE\Treadstone\File Sweeper" "NETWORK_LOCATION" SAVEFILEPATH)
View 1 Replies
View Related
Mar 8, 2013
I would like to create a lisp that does the following:
Update a titleblock attribute with a $variable.
The titleblockname is variable / not static.
The attribute is not variable / Static, DW_SCALE
The titleblock is always places on the same layer, BL$4----
The (custom)-plotscale is stored in the $var "gvpsc".
I've tried to ajust the following lisp code. But I couldn't extract the part I need.
The problem is, the code checks all the layouts and updates all the titlblocks one by one.
Truely a good code.
The only problem is, I don't have multiple layouts and I have a variable titleblock name.
Here is to code i've tried to convert to something I could use.
(defun C:UPD-DPC () (setvar "cmdecho" 0) (setq blkname "DPC-STEMPEL");(getstring "
Enter the name of block to update: ")) (setq att1 "DW_DATE");(strcase(getstring "
Enter the name of the attribute to change: "))) (setq newatt (strcase(getstring "
[Code] ....
View 9 Replies
View Related
Apr 26, 2012
I want to know if it's possible to replace a drive by an environment variable in a search path in the profile. For example:
to replace C:Program FilesAutodeskAutoCAD Mechanical 2012Acadm by %LOCAL DRIVE%Program FilesAutodeskAutoCAD Mechanical 2012Acadm.
View 5 Replies
View Related
Oct 24, 2013
I am looking for some way to store variables. For example in loop I want to
Enter a number
1
Enter hatch pattern
Ansi31
Enter a number
3
Enter hatch pattern
Ansi32
Enter a number
1
Enter hatch pattern <Ansi31>
Enter
Enter a number.... etc.
View 9 Replies
View Related
Aug 28, 2009
I want to set the break size in all of my dimstyles but I can't find a system variable for it. know what it is or how else to set it?
View 2 Replies
View Related
Mar 21, 2012
I have this small lisp routine:
(defun c:1p nil
(command "_.-plot" "yes" "" "controls 11x17" "Ledger (11 x 17)" "inches" "LANDSCAPE" "NO" "view" "01" "FIT" "CENTER" "YES" "newpap2.ctb" "YES" "As" "NO" "NO" "yes" )
(princ)
)
I want to use it to plot different views which I will append to the command when it is called from within AutoCAD.This code will, of course, print view one.Currently my worst case is 25 views and, for that situation, I have simply repeated this code 25 times with a different function name an view number for each view. Eventually I would like to make a dialog box that would allow me to select with checkboxes (toggles) the views to print and with a button to print all.
For example, if I wanted to plot view 25, after I had loaded this lisp routine I would enter, on the command line in AutoCAD, the function name ("pp" perhaps?) followed by some variable (in this case 25, but could be any view name. ie. 01, elev, detail) and the view name would be inserted at the appropriate place.
View 3 Replies
View Related
Oct 24, 2011
I am using a variable that is being called up from a .csv file for a file name. By default this variable automatically includes a comma due to it being called from a .csv.
How to remove a character ( , ) from a variable? I'm not sure if this is along the right line or not, but i used the READ function to read the variable as a string (i think thats how it works?).
View 9 Replies
View Related
Jun 11, 2012
I would like to know how I can compare the value of a variable to a set string of text if the two prove to be equal perform task A if the two prove different perform task B?
View 7 Replies
View Related
Feb 18, 2013
I write a code to replace strings in one string.for example
str="AutoDesk, AutoCAD, 2013, Electrical, 64Bit"
patt=", "
NewStr=" - "
==> result: "AutoDesk - AutoCAD - 2013 - Electrical - 64Bit"
;;replaces NewStr instead of Patt(s) in Str string(defun ReplaceStr (NewStr Patt Str)(While (> (vl-string-search ptt str) 0)(setq Str (vl-string-subst NewStr patt Str)) );;whilestr) ; usage;(ReplaceStr " - " ", " "AutoDesk, AutoCAD, 2013, Electrical, 64Bit")
==> result= ; error: bad argument type: (or stringp symbolp): nil
View 9 Replies
View Related
Oct 4, 2012
I have attached 2 lisp files. datblkx5 makes a block of selection, inserts the block with a 5x distortion, explodes it, and corrects the text for width factor and text height. This one works fine.
I wanted to add the feature of scaling my selection with a user input value. This is the lisp datblkxxx. This one doesn't work. (that is it doesn't correct the text for width factor). I can't figure it out.
View 3 Replies
View Related
Dec 30, 2013
Is it possible to change the system variable "TEXTSIZE" with an autolisp routine? I have hundreds of drawings that have varying textsize settingings and I can't get it to let me change it, unless I go into "Style" and manually change the value to "0" before I run the routine, and there are simply too may drawings to do that everytime. So, is there a way to reset the textsize to 0 through Lisp?
View 5 Replies
View Related
Jun 14, 2013
I am writing a LISP program to generate development of surfaces. Once the entire drawing is completed, I want that the input data to be displayed on drawing window as text.
View 2 Replies
View Related
Oct 3, 2012
When scrolling through the list of variables (accessed through the commands prompt -> Setvar ->?
->*)
that all variables pointing to a path show backslashes except for SAVEFILEPATH.
View 5 Replies
View Related
Apr 5, 2013
I'm looking for a way to find out what all plot styles are set in drawings in a sheet set.
We are transitioning from color based pen settings to style based and would like to be able to export a log that shows the variable PSTYLEMODE for each drawing in a sheet set. I plan on using ScriptPro to run it on the full sheet set.
Civil 3D 2013
Windows 7 64-bit
Xeon W3550 3.07 GHz
Nvidia Quadro 4000
12.0 GB RAM
View 2 Replies
View Related
Feb 22, 2012
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
View 2 Replies
View Related