Leaderboard
Popular Content
Showing content with the highest reputation on 11/12/2021 in all areas
-
Just use CUT (CTRL+X) and Paste (CTRL+V), though you wouldn't be able to select a base point, if that's necessary. You might be able create a Macro to Copybase>Select Base Point>Delete>Paste, if you don't want to do it manually. If you want to use COPY, COPY>Select>Pick Base Point>move object to new location>(E)rase>(P)revious>Enter2 points
-
So, if I read this correctly, you have 2 lists in the example. List 1 is the raw numbers List 2 are the numbers rounded to the nearest 0.5?. If you add together all List 1 you get a different answer to adding all of list 2. Your routine is probably doing exactly what you have told it to do. I think you need to sum together all the raw numbers and then round the result to get an accurate answer. Imagine a shorter list: 2.25 2.25 2.25 2.25 2.25 2.25 + 2.25 + 2.25 + 2.25 + 2.25 = 11.25 Go with your method and sum up the original list that's been rounded to the nearest 0.5? 2.5 + 2.5 + 2.5 + 2.5 + 2.5 = 12.5 Suppose you want the answer to the nearest whole number? Lets round the results....11.25-->11 and 12.5-->13 However what happens if you want then to the nearest 5? lets round the results....11.25-->10 and 12.5-->15 or nearest 10, could do that by rounding the last set of results, 10-->10 and 15-->20 (showing that rounded a rounded number can create a larger error) Hoping this shows that you are going to get errors adding together rounded numbers rather than going back to the originals values, summing them all up and then rounding to the precision you need from the original unrounded sum. Each time you repeat the process you are potentially adding in more errors.1 point
-
I am not surprised that the sums are different. It is nothing to do with lists but the way you are abusing mathematical operations. The sum of your list is 73911 point
-
; tells lisp to ignore anything after it until next line. Basically used to make comments/notes inside of lisp. If you uncommnet or remove the ; ; when you load the lisp it will then automatically run itself after loading.1 point
-
steven youre awesome for this, the stack is hundreds, but they are grouped in folders of 30-50, what does the double semicolon do, and removing it will result in what when running the app? additionally, I have that leemac tool loaded, if I load your script into it youre saying I wont have to delete the double semicolon? thanks1 point
-
How many drawings is "a giant stack" by the way?, and is this a one off task? It might be just as quick to open them all manually and run a LISP as trying to work out the accoreconsole (I haven't been too successful with it, but never had a lot of time to make it do what I want), Below is a quick LISP that should do setbylayer to all the text on layer 12. Copy this to notepad and save as something like "mysetbylayerlisp.lsp", then use appload command add this file to the startup suit. Whenever you open AutoCAD this will be available to use. (this link http://lee-mac.com/runlisp.html has a better explanation and description). Depending how many files you have, delete the last two ;; in your LSP file, save, and then open one of your giant stack... this should run when the drawing is opened, and you can just close the drawing again - might be just as quick as working out batch processes. However again Lee Mac might come to the rescue here with this http://www.lee-mac.com/scriptwriter.html (don't need to delete the last two ;; for this) (defun c:resetbylayer ( / ) (command "_.setbylayer" (ssget "_A" '((0 . "*TEXT")(8 . "12"))) "" "" "") (command "_.qsave") ) ;; (c:resetbylayer)1 point
-
Two ways: (setq L '(43.0 75.325 36.5707 42.0 558.104 900.0 533.429 40.0 36.5707 78.0 64.2525 37.4287 45.0 65.3188 900.0 900.0 179.571 30.0 78.4287 73.0 34.0 505.0 800.0 162.351 26.0 50.0 35.0 35.0 591.649 70.0 130.0 130.0 105.0 0.0)) _$ (apply '+ L) 7390.0 _$ (eval (cons + L)) 7390.01 point
-
Its actually 7389.9991 (defun SumLst (lst / sum) (setq sum 0) (if (listp lst) (foreach num lst (if (numberp num) (setq sum (+ sum num)) ) ) ) sum ) --Edit--- Examples : (SumLst '(1 5 3 10.312 15 -2.35)) : 31.962 or : (setq num '(1 5 3 10.312 15 -2.35)) : (SumLst num) : 31.9621 point
-
Try this. This is your alternative, copy objects and then delete the originals Note that the 'copy' command doesn't show the copied objects moving about - couldn't remember how to make the loop work apart from how I have it below. (defun c:trythis () (setq sset (ssget)) (setq pt1 (getpoint "Select Base Point:")) (while (setq pt2 (getpoint "Select Next Point or <enter> or <space>:")) (command "copy" sset "" pt1 pt2) ) (command "erase" sset "") )1 point
-
This inspired me to make simple (better ways to do welcomed) version for copybase with deselection feature which is built-in in my previous used drawing program Cadmatic. Sharing this is my way to thank for whole forum for its existness . If someone is interested I have trimmed also other general commands. Eg. previous selection set saved without need to do anything with that set because I often press esc at "wrong" time and current selected set did not save in previous selected set (for my Cadmatic-built-in affected finger ). (this might be off-topic so please moderate message if needed cause first time here) ;; for deselect objects after copying (defun C:C ( / ss from); (setq ss (ssget "_I")) (cond ((null ss) ; if objects not yet selected (princ "\nSelect objects") (setq ss (ssget "_:L")) (setq from (getpoint "\nSpecify base point:") ) (command "_.copybase" from ss "") (princ) ); cond1 ends ;(command "copybase" pause pause "") ((> (sslength ss) 0) ; if objects ready selected (setq from (getpoint "\nSpecify base point:") ) (command "_.copybase" from ss "") (princ) ); cond2 ends ;(command "copybase" pause pause "") ); cond ends (ai_deselect); deselect objects ); defun CopyBaseDeselect.lsp1 point
-
The issue stems from how the original was created and it is reflecting the size of the saved pdf not a dwg size, I just did a A1 title block made a pdf at 1=1 scale then did pdfafttach at 1=1 scale it appears to be spot on. There is some posts about getting info from a pdf so size may be one of them then could write a lisp to do the pdfttach and rescale as required. Also remember say the plan may have a scaling factor for the viewport say for a house like 1:100. This may be the problem it can be inches, look at the mm.1 point
-
If you're doing a lot of 3D work, I would recommend a desktop PC with at least a 6 core processor, 16GB RAM and a mid range dedicated graphics card. Integrated graphics are not ideal for doing 3D work. I was looking around a few days ago and found some pretty decent ones at Best Buy for under $1,500. This one would probably work well for what you're doing: Element Mini Gaming Desktop1 point
-
Yes, it's possible : ;; change attribute ;; https://www.cadtutor.net/forum/topic/73972-pre-fill-in-getstring/ (defun c:attch ( / LM:vl-setattributevalue adoc att blk tag ) (vl-load-com) (setq adoc (vla-get-activedocument (vlax-get-acad-object))) ;; Set Attribute Value - Lee Mac ;; Sets the value of the first attribute with the given tag found within the block, if present. ;; blk - [vla] VLA Block Reference Object ;; tag - [str] Attribute TagString ;; val - [str] Attribute Value ;; Returns: [str] Attribute value if successful, else nil. (defun LM:vl-setattributevalue ( blk tag val ) (setq tag (strcase tag)) (vl-some (function (lambda ( att ) (if (= tag (strcase (vla-get-tagstring att))) (progn (vla-put-textstring att val) val) ) ) ) (vlax-invoke blk 'getattributes) ) ) (while (setq att (car (nentsel "\n select attribute to change: "))) (setq blk (cdr (assoc 330 (entget att)))) ;; get parent block of a nentsel (setq tag (cdr (assoc 2 (entget att)))) (princ tag) (vla-sendcommand adoc "new_value_") ;; this is the trick to add predefined prefix to (getstring) specification that follows... (LM:vl-setattributevalue (vlax-ename->vla-object blk) tag (getstring T "\nNew value : ")) ) (princ) ) HTH. M.R.1 point
-
If you want a block just explode the table and make it a block. Routine places length of all vertices at this time. It's not hard to remove duplicates but to foolproof let the routine decide which one to remove I haven't cracked yet and not very important , not to me anyway because right now I have another appie in need of my help (else I have to do all the work myself and that's not what I had in mind when I got out of bed at 5 am this morning) Harshad2.lsp1 point