Leaderboard
Popular Content
Showing content with the highest reputation on 03/19/2021 in all areas
-
Ok... that one works. I think mine had a poltergeist. Seriously. WTF mate? Thank you for your help! Seriously appreciated. Such a simple block shouldn't have taken two people and this much conversation...1 point
-
You need to use a dynamic block for this to work (without Lisp ). It doesn't matter what dynamic action you use, any will do, I usually make use of a visibility state with 2 states (make sure everything is visible in both states). The problem is when you insert the block the first attribute is fine, but the field in the second attribute (which you should make sure is set to 'preset' in the properties) will try and copy the contents of the first attribute but will use the value contained in the 'block description' (The default value). If you make a change to a dynamic action, then the block becomes an annonymous block and the second attribute will now read the value from the inserted block and not the block description default value. You will need to regen for any changes to show up in the field. It would be best to recreate your block from scratch, but if you do just edit the existing block then you will need to run the 'attsync' command.1 point
-
Hi guys try this just type tblockname uses current mleader style. It uses the first character so could have 52 reactors pretty easy. A is not a. Examples type T001, Tnorth, tstop a couple of probs space in block name and does it exist. So that is fillet, circle, offset, copy project and now blocks. It really comes down to how to trap errors, if you type say a user command wrong testisssthisreport it will try to use that description as a block name. ; Big thanks to lee-mac for making it work. ; mlblk uses block name pulls the name from the T or t and then runs mlblk ; BY Alan H 2021 ( (lambda nil (vl-load-com) (foreach obj (cdar (vlr-reactors :vlr-command-reactor)) (if (= "mlblk-reactor" (vlr-data obj)) (vlr-remove obj) ) ) (vlr-command-reactor "mlblk-reactor" '((:vlr-unknowncommand . mlblk-reactor-callback))) ) ) (defun mlblk( / str) (setq bname (substr (nth 0 com) 2) ) (if (not (tblsearch "block" bname)) (alert "no block by that name") (progn (setq pt1 (getpoint "\nPick landing point ") pt2 (getpoint pt1 "\nPick next point ")) (setq str (strcat "mLeader _O _C _B " bname (chr 13) "exit !pt1" (chr 13) "!pt2" (chr 13))) (vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) str) ) ) ) (defun mlblk-reactor-callback ( obj com ) ( if (= (wcmatch (strcase (car com)) "T*") T)(mlblk ) ) ) ; defun (or mlblk-reactor-acdoc (setq mlblk-reactor-acdoc (vla-get-activedocument (vlax-get-acad-object))) )1 point
-
You can remove a lot of the code but you will need to pick the table still for the hittest, either do at start check is tableobj nil then pick table, note you will have to reset tableobj to nil to select another table.1 point
-
pretty sure problem is when do second attribute you have to reset the field being copied to the current attribute in the current block. So block has field1id same block inserted again has field2 id. This is not your solution but was a solution for the problem of two atts. It adds attributes and displays in last attribute so change any att value and sum changes. (defun c:test ( / obj lst x str) (setq oldatt (getvar 'attdia)) (setvar 'attdia 0) (command "-insert" "test" (getpoint "\npick point") 1 1 0 (getstring "\nEnter Att1 ") (getstring "\nEnter Att2 ") (getstring "\nEnter Att3 ") "-") (setq obj (vlax-ename->vla-object (entlast))) (setq lst '()) (foreach att (vlax-invoke obj 'getattributes) (princ "\n") (setq lst (cons (strcat "%<\\AcObjProp Object(%<\\_ObjId " (vlax-invoke-method (vla-get-Utility (vla-get-activedocument (vlax-get-acad-object))) 'GetObjectIdString att :vlax-false) ">%).Textstring>%" ) lst )) ) (setq str nil) (setq x (length lst)) (setq str (strcat "%<\\AcExpr (" (nth (setq x (- x 1)) lst) "+" (nth (setq x (- x 1)) lst) "+" (nth (setq x (- x 1)) lst) ")>%" ) ) (setq x 1 y 4) (foreach att(vlax-invoke obj 'getattributes) (if (= x y) (Vla-put-textstring att str) ) (setq x (+ x 1)) ) (setvar 'attdia oldatt) (princ) ) (c:test)1 point
-
I am lucky and here in AUS we have HFS fonts hundreds of traffic signs as TTF so a stop sign is say "A" using correct font. Anyway back to question, there may be a way of using a reactor to run a lisp that creates a mleader but puts correct block as answer. You would type say TSTOP or tgiveway tchevron1 I have used this before for doing offset fillet circles plus some other stuff Block insert is Bblockname. The reactor detects the error TSTOP is invalid command and pulls it apart so would know the block name is "STOP" I dont think making hundreds of mleaders styles is the way to go. Have you looked at selecting the sign from a dcl Here is the reactor code you could have a go using "T" rather than "F" will have a think about a mleader. You need to rewrite the defun filletrad for a mleader. ; Fillet rad uses Frad eg f100 puls the 100 from the F and then runs fillet ; BY Alan H 2015 ; great assistance from Lee-mac to make it work. ( (lambda nil (vl-load-com) (foreach obj (cdar (vlr-reactors :vlr-command-reactor)) (if (= "fillet-reactor" (vlr-data obj)) (vlr-remove obj) ) ) (vlr-command-reactor "fillet-reactor" '((:vlr-unknowncommand . fillet-reactor-callback))) ) ) (defun filletrad ( / rad) (setq rad (distof (substr com 2) 2)) (if (<= 0.0 rad) (progn (setvar 'filletrad rad) (vla-sendcommand fillet-reactor-acdoc "_.fillet ") ) ) ) (defun fillet-reactor-callback ( obj com ) (setq com (vl-string-translate "-" "." (strcase (car com)))) (cond ( (and (wcmatch com "~*[~F.0-9]*") (wcmatch com "F*") (wcmatch com "~F*F*") (wcmatch com "~*.*.*") ) ; and (filletrad) ) ) ; master cond ) ; defun (or fillet-reactor-acdoc (setq fillet-reactor-acdoc (vla-get-activedocument (vlax-get-acad-object))) )1 point
-
I am not suprised at the numbers, David Bethel is in the lead, waiting to see others. Like David 236 for one project, around 2 years of work. A lot are downloaded snippets for tasks. Really do need to clean up and get rid of duplicates and versions. I need to do an index like GRRR, the .Doc was just a small part of common used. Tombu copy your menu.cuix rename to menu.zip, unzip, will now have xml files try from Windows CMD, FINDSTR C : *.xml need to be in correct directory, looking for say c:A.... I think I got same $50 from Hot tip Harry and only spent like half of it. Lisp files march 2021.docx1 point
-
My "_LISP" folder is catalogued with subfolders, where I had categorised different things related to AutoCAD development, so a bunch of .jpg .pdf .txt and mostly .lsp files. I use it when I have to build something from scratch, within it I have 'Pontentially used lisps' which contains 915 files at the moment. - bunch of .lsps with (C:test) calls which I don't load at my ACAD startup. My "AUTOLISP" folder is the .lsp-s loaded at startup, but it also contains subfolders with other extension file formats, like I keep folder with 450 font files within it. So roughly 550 .lsp and .vlx files which I keep for loading, where I cleared many of them in my acad.pgp loading list. To sum up I'm loading like 50 .lsp files at startup and maybe use 10-20 routines most oftenly. The thing is that its overwhelming to remember the function names and which routine does exactly what, so in my recent years I've tried to write the most generic useful routines for the work I do. In the past I had the idea to use command calls reactor which counts any commands I invoke while working on a project, so I could clear-up and consolidate lisps due the statistics I had. (back then I've actually created a topic here at CADTutor, where I turned it up into a game) Sample statistics attached for a project I was working on for 3 days. Now I'm recently doing something similar with JS for PhotoShop as a catalogued folder structure.. because of the work I have to do (and to automate for myself).1 point
-
lspsurf.exelspsurf.lspBy the way I just found something like that installed in the Express tools from Autodesk It's a small software that allows you to see your routines and to have a quick look at them. I just hope it can be useful to you too. Althought it can be useful to have a look at your code Steven, I really like this forum, where one can always keep learning. Thanks to you all guys.1 point