All Activity
- Today
-
Ok found out a bit more if you have shallow angles then whilst it still works. from a drafting point of view is not desirable, as an example I get 12" and 8' 2" so line work draws over original line, will fix. I have updated the code try this. ; https://www.cadtutor.net/forum/topic/97227-bevel-slope-label/ ; draw bevel label ; By AlanH April 2025 (defun c:bevel ( / h0180 ah090 ah2700 ang d1 d2 dist dofracs dofracs endpt ht oldangdir oldcol oldsnap pt2 pt2a startpt tanang) ; thanks to lee-mac for this defun (defun csv->lst (str ans / pos ) (if (setq pos (vl-string-position ans str)) (cons (substr str 1 pos) (csv->lst (substr str (+ pos 2)) ans)) (list str) ) ) (defun dofracs ( / a ht1 ht2 ht3 ht4 frac) (setq frac (- ht (fix ht))) (setq frac (atof(rtos frac 2 3))) (if (> frac 0.0) (progn (setq txt (rtos ht 4 4)) (setq a (csv->lst txt 32)) (setq ht1 (car a)) (setq ht2 (csv->lst (cadr a) 47)) (setq ht3 (car ht2)) (setq ht4 (cadr ht2)) (setq httxt (strcat ht1 "{\\H0.70x;\\S" ht3 "#" ht4 ";}")) ) (setq httxt (rtos ht 2 0)) ) (princ) ) (DEFUN AH090 ( / angt ht mp pt3 pt4) (setq pt3 (polar pt2a (* pi (- 0.5)) dist)) (setq pt4 (polar pt3 pi 4.)) (command "line" startpt pt2 "") (command "line" pt2a pt3 "") (command "line" pt3 pt4 "") (setq ht (* 3. dist)) (setq angt (/ (* ang 180.0) pi)) (setq mp (mapcar '* (mapcar '+ pt2a pt3) '(0.5 0.5))) (setq mp (mapcar '+ mp '(0.25 0.0 0.0))) (dofracs) (command "mtext" mp "J" "ML" mp httxt "") (setq mp (polar pt3 pi 2.0)) (setq mp (mapcar '+ mp '(0.0 -0.25 0.0))) (command "text" "J" "TC" mp 1 0.0 "12\"") (setq mp (mapcar '* (mapcar '+ pt2a pt4) '(0.5 0.5))) (setq mp (mapcar '+ mp '(0.0 0.25 0.0))) (setvar 'angdir 0) (command "text" "J" "BC" mp 1 angt (strcat (rtos angt 2 2) "%%d")) (princ) ) (DEFUN AH90180 ( / angt ht mp pt3 pt4) (setq pt3 (polar pt2a (* pi 1.5) dist)) (setq pt4 (polar pt3 0.0 4.)) (command "line" startpt pt2 "") (command "line" pt2a pt3 "") (command "line" pt3 pt4 "") (setq ht (* 3. dist)) (setq angt (/ (* (- pi ang) 180.0) pi)) (dofracs) (setq mp (mapcar '* (mapcar '+ pt2a pt3) '(0.5 0.5))) (setq mp (mapcar '+ mp '(-0.25 0.0 0.0))) (command "mtext" mp "J" "MR" mp httxt "") (setq mp (polar pt3 0.0 2.0)) (setq mp (mapcar '+ mp '(0.0 -0.25 0.0))) (command "text" "J" "TC" mp 1 0.0 "12\"") (setvar 'angdir 1) (setq mp (mapcar '* (mapcar '+ pt2a pt4) '(0.5 0.5))) (command "text" "J" "BC" mp 1 angt (strcat (rtos angt 2 2) "%%d")) (princ) ) (DEFUN AH180270 ( / angt ht mp pt3 pt4 ) (setq pt3 (polar pt2a (* pi 0.5) dist)) (setq pt4 (polar pt3 0.0 4.)) (command "line" startpt pt2 "") (command "line" pt2a pt3 "") (command "line" pt3 pt4 "") (setq ht (* 3. dist)) (setq angt (/ (* (- ang pi) 180.0) pi)) (dofracs) (setq mp (mapcar '* (mapcar '+ pt2a pt3) '(0.5 0.5))) (setq mp (mapcar '+ mp '(-0.25 0.0 0.0))) (command "mtext" mp "J" "MR" mp httxt "") (setq mp (polar pt3 0.0 2.0)) (setq mp (mapcar '+ mp '(0.0 0.25 0.0 ))) (command "text" "J" "BC" mp 1 0.0 "12\"") (setvar 'angdir 0) (setq mp (mapcar '* (mapcar '+ pt2a pt4) '(0.5 0.5))) (setq mp (mapcar '+ mp '(0.0 -0.25 0.0 ))) (command "text" "J" "TC" mp 1 angt (strcat (rtos angt 2 2) "%%d")) (princ) ) (DEFUN AH2700 ( / angt ht mp pt3 pt4 ) (setq pt3 (polar pt2a (* pi 0.5) dist)) (setq pt4 (polar pt3 pi 4.)) (command "line" startpt pt2 "") (command "line" pt2a pt3 "") (command "line" pt3 pt4 "") (setq ht (* 3. dist)) (setq angt (/ (* (- (* 2.0 pi) ang) 180.0) pi)) (dofracs) (setq mp (mapcar '* (mapcar '+ pt2a pt3) '(0.5 0.5))) (setq mp (mapcar '+ mp '(0.25 0.0 0.0 ))) (command "mtext" mp "J" "ML" mp httxt "") (setq mp (polar pt3 pi 2.0)) (setq mp (mapcar '+ mp '(0.0 0.25 0.0 ))) (command "text" "J" "BC" mp 1 0.0 "12\"") (setvar 'angdir 1) (setq mp (mapcar '* (mapcar '+ pt2a pt4) '(0.5 0.5))) (setq mp (polar mp (- ang (/ pi 2.0)) 0.25 )) (command "text" "J" "TC" mp 1 angt (strcat (rtos angt 2 2) "%%d")) (princ) ) ;; starts here (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) (setq oldcol (getvar 'cecolor)) (setvar 'cecolor "1") (setq oldangdir (getvar 'angdir)) (setvar 'textstyle "standard") (setvar 'textsize 1) (setq pi90 (* 0.5 pi) pi180 (* 1.5 pi)) (if (= (tblsearch "layer" "Beveldim") nil) (command "-layer" "M" "Beveldim" "C" "1" "" "") (setvar 'clayer "Beveldim") ) (setq ent (entsel "\npick a line near end ")) (setq obj (vlax-ename->vla-object (car ent))) (setq startpt (vlax-curve-getstartPoint obj)) (setq endpt (vlax-curve-getEndPoint obj)) (setq pt1 (cadr ent)) (setq d1 (distance pt1 startpt)) (setq d2 (distance pt1 endpt)) (if (> d1 d2) (setq tmp startpt startpt endpt endpt tmp) ) (setq ang (angle endpt startpt)) (setq tanang (abs (/ (sin ang) (cos ang)))) (setq dist (abs (* 4.0 tanang))) (setq hyp (abs (/ 4.0 (sin (- ang (* 1.5 pi)))))) (setq hypsc (/ hyp 6.25)) (if (< hypsc 1.0)(setq hypsc 1.0)) (setq pt2 (polar startpt ang (+ 2.0 (* hypsc 6.5)))) (setq pt2a (polar startpt ang (+ 2.0 (* hypsc 6.25)))) (cond ((and (>= ang 0.0)(< ang (* pi 0.5)))(AH090)) ((and (> ang 1.5707964267949)(< ang pi ))(AH90180)) ((and (> ang 3.14160265358979)(< ang (* 1.5 pi )))(AH180270)) ((and (> ang 4.71239898038469)(< ang (* 2.0 pi )))(AH2700)) ) (setvar 'osmode oldsnap) (setvar 'cecolor oldcol) (setvar 'angdir oldangdir) (princ) ) (c:bevel)
-
The result of the difference of two columns with numbers
BIGAL replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Comparing rows of text is not a problem it can be done very easy have done many times but this confuses me. How do you pick the two numbers to compare, if it's in order on right examples then must be done in a pick pick manner if its as per "correctly" on right then yes its easy. This one Or this one -
This works great. Can you possibly change it to remove the two XLINES that are created and the arc as these are not needed at the end.
- Yesterday
-
-
Steven P started following The result of the difference of two columns with numbers
-
The result of the difference of two columns with numbers
Steven P replied to Nikon's topic in AutoLISP, Visual LISP & DCL
I haven't looked at the example - weekend and CAD is off, but how many rows do you have to calculate and on how many drawings? Reason I ask is I often find that the rule a LISP operates with are often not perfect and don't accommodate every situation - If the operation I need to do is not excessive then I refer to do it be select row text 1, row 1 text 2 and then place the result, repeat with row 2, and so on Things to also consider is an overkill on the texts to assess to remove duplicates, check that any mtexts are 1 line texts, text 1 or 2 are strings and not numbers, texts are not text or mtext (attributes, blocks, rtexts (they happen), mtexts don't cover both columns, texts don't cover both columns... and many more things that can stop the routine from completing or making a miss match from one column to the next. -
Here is a drawing with some lines and the bevel symbols that are just made from lines and dimensions. Which I created with a wblock as requested. I hope this is as you requested, Please correct me if it's not the way you wanted. block.dwg
-
The result of the difference of two columns with numbers
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Hi There's a problem with n1 and n2: they're likely referring to texts that are next to each other. But that's unlikely to happen because it depends on the order in which they are found in the database. You should create a function that: 1) compares the texts in the two columns 2) relates each pair of texts because they both have the same x coordinate (with a maximum range of 1/2 the height of both texts) 3) creates a list for each columns sets with the texts in order from highest Y to lowest. Then modify your 'repeat' to iterate over the members of both lists: (nth ind lstColumn1) will always be in the same row as (nth ind lstColumn2) -
RANSONNEIL joined the community
-
Convert multy txt files - Update an old code
mhy3sx replied to mhy3sx's topic in AutoLISP, Visual LISP & DCL
I try your code. Ithink it works. I will test more. Thanks GLAVCVS -
Convert multy txt files - Update an old code
GLAVCVS replied to mhy3sx's topic in AutoLISP, Visual LISP & DCL
PS: Try it. I haven't done it. -
Convert multy txt files - Update an old code
GLAVCVS replied to mhy3sx's topic in AutoLISP, Visual LISP & DCL
The main function, modified, could be like this: (defun c:test (/ FF FFN TXT TXTS ab d lst rpta) (if (setq d (getfiled "Select file " "" "txt" 0)) (progn (while (not (member (setq rpta (strcase (getstring (strcat "\nConvert Only \'" (setq ab (vl-filename-base d)) ".txt\'? <Only>/All directory: ")))) '("" "O" "A"))) (princ "\n* Invalid option * Try again (ENTER, O or A) ...") ) (if (= rpta "A") (setq lst (vl-directory-files (vl-filename-directory d) "*.txt")) (setq lst (list (strcat ab ".txt"))) ) (foreach ffn lst (setq ff (open (setq ffn (strcat (vl-filename-directory d) "\\" ffn)) "r") txts nil ) (while (setq txt (read-line ff)) (setq txts (cons txt txts)) ) (close ff) (setq txts (mapcar '(lambda (x) (STD-STRSPLIT x "\t,; ")) (reverse txts))) (setq txts (mapcar '(lambda (x) (vl-remove-if '(lambda (y) (and (not (equal "0" y)) (zerop (atof y)))) x ) ) txts ) ) (setq ff (open (strcat (substr ffn 1 (- (strlen ffn) 3)) "pl") "w")) (foreach item txts (write-line (strcat (cadr item) "," (caddr item)) ff) ) (close ff) ) (startapp "explorer" (vl-filename-directory (strcat (vl-filename-directory d) "\\"))) ) ) (princ) ) -
The result of the difference of two columns with numbers
Nikon posted a topic in AutoLISP, Visual LISP & DCL
I need to select two columns with numbers and get the result (difference) in the third column. This code sometimes misidentified the difference, I can't figure out what the reason is. (defun c:Df2Column ( / col1 col2 n1 n2 p1 p2 p3 basept dy txt1 txt2 i ent1 ent2) (princ "\nSelect the texts of the first column: ") (setq col1 (ssget '((0 . "TEXT,MTEXT")))) (if (not col1) (progn (princ "\nThe objects of the first column are not selected.") (exit)) ) (princ "\nSelect the texts of the second column: ") (setq col2 (ssget '((0 . "TEXT,MTEXT")))) (if (not col2) (progn (princ "\nThe objects of the second column are not selected.") (exit)) ) (if (/= (sslength col1) (sslength col2)) (progn (princ "\nThe number of objects in the columns does not match.") (exit)) ) (princ "\nSpecify the insertion point of the third column: ") (setq basept (getpoint)) ;; Defining the step by Y between the elements of the second column (setq ent2a (ssname col2 0)) (setq ent2b (ssname col2 1)) (setq y1 (cadr (cdr (assoc 10 (entget ent2a))))) (setq y2 (cadr (cdr (assoc 10 (entget ent2b))))) (setq dy (- y2 y1)) (setq i 0) (repeat (sslength col1) (setq ent1 (ssname col1 i)) (setq ent2 (ssname col2 i)) (setq txt1 (cdr (assoc 1 (entget ent1)))) (setq txt2 (cdr (assoc 1 (entget ent2)))) (setq n1 (atof txt1)) (setq n2 (atof txt2)) (if (and n1 n2) (progn (setq p3 (list (car basept) (+ (cadr basept) (* i dy)) 0.0)) (entmakex (list (cons 0 "TEXT") (cons 8 (cdr (assoc 8 (entget ent2)))) (cons 10 p3) (cons 40 (cdr (assoc 40 (entget ent2)))) (cons 1 (if (> (- n1 n2) 0) (strcat "+" (rtos (- n1 n2) 2 3)) (rtos (- n1 n2) 2 3))) )) ) ) (setq i (1+ i)) ) (princ) ) difference.dwg -
Convert multy txt files - Update an old code
GLAVCVS replied to mhy3sx's topic in AutoLISP, Visual LISP & DCL
Hi You simply need to get the list of files in that directory with 'vl-directory-files' and create a loop so the code repeats for each file. -
Hi. I use this lisp code to convert the form of a txt file from this 0 299153.24 4218596.34 1 299163.21 4218607.51 2 299163.99 4218607.02 3 299176.94 4218599.90 4 299207.37 4218583.27 5 299220.70 4218575.98 6 299242.94 4218563.71 7 299253.41 4218557.75 8 299256.14 4218556.19 9 299253.94 4218553.77 10 299251.66 4218551.25 11 299248.52 4218547.79 12 299244.81 4218549.59 13 299235.68 4218554.00 14 299218.39 4218562.90 15 299197.46 4218573.57 16 299177.72 4218583.74 17 299164.10 4218590.73 18 299153.87 4218596.07 19 299153.24 4218596.34 to 299153.24,4218596.34 299163.21,4218607.51 299163.99,4218607.02 299176.94,4218599.90 299207.37,4218583.27 299220.70,4218575.98 299242.94,4218563.71 299253.41,4218557.75 299256.14,4218556.19 299253.94,4218553.77 299251.66,4218551.25 299248.52,4218547.79 299244.81,4218549.59 299235.68,4218554.00 299218.39,4218562.90 299197.46,4218573.57 299177.72,4218583.74 299164.10,4218590.73 299153.87,4218596.07 299153.24,4218596.34 The code works fine but convert only one file a time. Is it possible to update the code to convert all *.txt files in the folder to *.pl at once . The code I use is (defun c:test (/ FF FFN TXT TXTS) (setq ffn (getfiled "Select file " "" "txt" 0) ff (open ffn "r") txts nil ) (while (setq txt (read-line ff)) (setq txts (cons txt txts))) (close ff) (setq txts (mapcar '(lambda (x) (STD-STRSPLIT x "\t,; ")) (reverse txts))) (setq txts (mapcar '(lambda (x) (vl-remove-if '(lambda (y) (and (not (equal "0" y)) (zerop (atof y)))) x)) txts ) ) (setq ff (open (strcat (substr ffn 1 (- (strlen ffn) 3)) "pl") "w")) (foreach item txts (write-line (strcat (cadr item) "," (caddr item)) ff)) (close ff) (princ) ) ;;; The order of chars in delim is not important. ;;; keeping null tokens, not as with std-strtok. ;;; Might be renamed to std-string-split ;;; by Vladimir Nesterowsky (defun STD-STRSPLIT (s delims / len s1 i c lst) (setq delims (vl-string->list delims) ; fixed len (strlen s) s1 "" i (1+ len) ) (while (> (setq i (1- i)) 0) (setq c (substr s i 1)) (if (member (ascii c) delims) (if (/= i len) ; "1,2," -> ("1" "2") and not ("1" "2" "") (setq lst (cons s1 lst) s1 "" ) ) (setq s1 (strcat c s1)) ) ) (cons s1 lst) ; ",1,2" -> ("" "1" "2") ) I upload some txt files to test the code Thanks 1.txt 2.txt 3.txt
-
hoangvinhthien joined the community
-
mhy3sx changed their profile photo
-
You can read and write direct to Excel. Not sure as to what info you want, it may be simply achieved or very time consuming. You need to look at one task at a time and what are the rules for that task, a recent one is get info 2 blocks, that have same attribute value and say connecting length. Can you post a dwg with individual tasks and expected results in a Excel.
-
Auto lisp for AutoCAD LT 2026 - to convert numerical values in text or Mtext in MM to Meters
BIGAL replied to xpapillon's topic in AutoLISP, Visual LISP & DCL
As it’s @lee-mack code he may want to comment. -
Extracting data to excel from selected objects on different layers
BIGAL replied to Hsanon's topic in AutoLISP, Visual LISP & DCL
Yes is answer but you need to add object type into the cond which at moment only looks at line and pline. You need more defund dohatch., doblock. in some other code I make a big list of all objects and values, then look at how many items in each value of the list find maximum and that is used for number of columns. Yes do have something for blocks, any blocks and a table is made, data is sorted and common items counted. Small fee is applicable, would need more code for hatches, lines & plines. -
Can you post me a sample of the bevels use wblock. I tested on random lines and it worked, all 4 quadrants. That is all that is needed some lines.
-
Aotomatic cogo point import from csv file
BIGAL replied to benlconstructors's topic in AutoLISP, Visual LISP & DCL
Re open civ3D database you can use a check of current version and it corresponds to say a Acad year the number for a particular year may be 24. But as it’s LT doubtful that you can access database anyway, the code though should work in LT as it uses a cond to compare version number with a Civ3D version number, they are different. On iPad else would post code. Import points, string via code and create surface, re YMG triangulation lisp. Desired task. Importing points is easy but needs a lookup library, string points under development should work in LT2024+. If someone wants to have a go with LT try the code @SLW210 and I posted. Please let me know how it goes.- 13 replies
-
- lisp
- cogo points
-
(and 2 more)
Tagged with:
-
Doing bundles is pretty straight forward when you have an example to look at, that is for Autocad, Bricscad is different. Hence next method. Whilst not an exe I got around it by using a install.lsp, it looks for a zip file with all your stuff in it, Yes lisp can be used to unzip to a nominated directory, part 2 is that the lisp loads custom menu,s sets support paths. So ready to go, for multiple users email the zip and lisp, save the zip somewhere and run the lisp. Happy to provide more info.
- Last week
-
Danielm103 started following install lisps, DCLs, Cuix
-
I like INNO, the only issue is that it generates a .EXE file You will want to create a .bundle package and have INNO put the package in %APPDATA%\Autodesk\ApplicationPlugins\\myapp.bundle https://help.autodesk.com/view/OARX/2025/ENU/?guid=GUID-5E50A846-C80B-4FFD-8DD3-C20B22098008 PackageContents.xml would have an entry for your cui as well https://help.autodesk.com/view/OARX/2025/ENU/?guid=GUID-40F5E92C-37D8-4D54-9497-CD9F0659F9BB
-
Aotomatic cogo point import from csv file
SLW210 replied to benlconstructors's topic in AutoLISP, Visual LISP & DCL
If time allows next week, I'll continue with exploring Map 3D, I haven't used it in a couple of years now. I might redo my LISP to add them to a specific layer (or create it), but I had hard coded it, I want to ask for the name next time. I did have it drawing a pline, but it was on all points ( in order), I only needed a pline between certain points (they all had the same identifier description). Main purpose was to place the points as 2D with just the text for Z and add in information as text as well (maybe add the option for 3D points and text locations). Does COGO create 3D? I cannot recall and didn't even think to try Map 3D for this job. The engineer heading this up has 2025 LT, was hoping to have it so he could update the drawing, but alas, the LISP doesn't work in LT. Maybe the option for PNEZD or PENZD?- 13 replies
-
- lisp
- cogo points
-
(and 2 more)
Tagged with:
-
Aotomatic cogo point import from csv file
troggarf replied to benlconstructors's topic in AutoLISP, Visual LISP & DCL
Maybe so, but as a fly on the wall, I have been enjoying learning from you two as you share knowledge and experience- 13 replies
-
- lisp
- cogo points
-
(and 2 more)
Tagged with:
-
Custom Application Setup Solved: How to load a .lsp file using C#? - Autodesk Community
-
MALIKFAIZAN joined the community
-
hello guys does anybody know how can i install my Lisps ,DCL, Cuix files by .EXE file ? is inno setup about it? does anything already exist?
-
hwagun0610 joined the community
-
Silver joined the community
-
Aotomatic cogo point import from csv file
SLW210 replied to benlconstructors's topic in AutoLISP, Visual LISP & DCL
Nice @BIGAL On further review for the OP, doesn't Civil 3D already have the ability to import CSV with the data to COGO point. Maybe you need to explain a little more what you are looking to accomplish. It seems the OP has gone AWOL.- 13 replies
-
- lisp
- cogo points
-
(and 2 more)
Tagged with: