Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/23/2022 in all areas

  1. https://www.cadtutor.net/forum/topic/75450-change-numbers-alphabet-column-numbers/ how about this, can convert number 1 ~ 12356630 But I lost to Gilles, haha It is super simple and correct, it supports up to the limit of fix num, so the range is wider. it's mathematically interesting. It has been a study for me.
    2 points
  2. As a non-Lisperatti,, and yet aspiring to help... Are you familiar with the commandline command " -dwgunits" YES, the leading hyphen is important, and needs to be included. Expand your commandline window to about 6 or 8 lines, to better understand all of the options which are available, and give you an accurate overview. It is a very powerful command, read all the options and go slowly. Take it around the block and kick the tires before running it on the real files, but it might be a command which you could include in a script, and run on all of your blocks. Consistency is important, there must be an in house company standard, right? Or should I say, there SHOULD be? Maybe you need them in both metric and Imperial? You could do that too, or UNITLESS? I hope that might help.
    2 points
  3. https://blog.draftsperson.net/wiseys-steel-shapes-lisp-program/ Wisey’s Steel Shapes.zip Revision H like this? maybe have to add EU profile
    2 points
  4. https://www.afralisp.net/ is nice with simple step by step instructions. https://www.cadtutor.net/tutorials/autolisp/quick-start.php also good start but one page. Coming to the forums regularly to see how people problem solve. look for answer from people with high scores. there are multiple ways to code things in lisp. usually it comes down to performance (what runs the fastest) but depending on user preference or other factors one type of code might win out over a faster code. Reading over the functions to understand how to use them. https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-4CEE5072-8817-4920-8A2D-7060F5E16547 Welcome and hope to see you around.
    2 points
  5. fas is "Compiled Fast-Load AutoLISP" The machine automatically optimizes it in a form that is easy to understand and fast. machine cannot understand lisp with alphabet in fact. every that code needs translation.
    2 points
  6. I keep being second to answer after Mhupp.. I spent a lot of time getting things wrong, still do, one thing that sometimes happens for me is that I set a global variable after I have used it, so on the second pass it picks up the value but in the first it doesn't do anything. For example (defun c:anexample ( / ) (setq MyNextBlockName "AThing") (if (= MyBlockName "AThing") (princ MyBlockName) ) (setq MyBlockName MyNextBlockName) (princ) ) Run it once, nothing, run it again and it displays "AThing" int he command line The other thing that often happens is it picks up a global variable from another unrelated LISP and tries to use that first off. For example I often use 'acount' in loops so if LISP 1 sets acount to 10 then LIPS2 might be: For example (defun c:Lisp1 ( / ) (setq acount 10) ) (defun c:anexample ( / ) (while (< acount 5) (princ "\n") (princ acount) (setq (+ acount 1)) ) (setq acount 0) ;;reset counter for next use ) Welcome to world of debugging a LISP! Frustrates me when in my head it all works OK, but my fingers decide to type other things in Oh, last thing.. spelling mistakes...
    1 point
  7. Said screw it and decided to use AHK to type in the (load "blahblah.lsp") and call the function on the commandline of the newly open drawing since on_doc_load.lsp don't wanna work. Adds an additional keypress for each drawing I iterate through, but screw it, it works.
    1 point
  8. Yup, I saw that one the other day Exceed, for what I was wanting to do BigAls idea might be simpler. If I get chance this week though I will try your version too
    1 point
  9. Wow Works perfect thanks! Good idea to specify the width first, I didn't think about that. Thanks Again Tom
    1 point
  10. Yeah, sure. Command TCCR. I let you first enter the width. Then, since you need that width multiple times I put the rest in a while loop. Of course you can hard code the width and remove the while if you want. ;; degrees to rad (defun deg2rad (deg / ) (/ (* deg pi ) 180) ) ;; draws a polyline (defun drawLWPoly (lst cls) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) (cons 70 cls)) (mapcar (function (lambda (p) (cons 10 p))) lst)))) ;; TCCR for: Two Click Centerline Rectangle (defun c:TCCR ( / w ang p1 p2 bl br tl tr) (setq w (getreal "\nWidth: ")) (while (setq p1 (getpoint "\nPoint 1:")) (setq p2 (getpoint "\nPoint 2:" p1)) ;; calculate bottom/left, bottom/right,... (setq ang (angle p1 p2)) (setq bl (polar p1 (- ang (deg2rad 90.0)) (/ w 2.0))) (setq tl (polar p1 (+ ang (deg2rad 90.0)) (/ w 2.0))) (setq br (polar p2 (- ang (deg2rad 90.0)) (/ w 2.0))) (setq tr (polar p2 (+ ang (deg2rad 90.0)) (/ w 2.0))) (drawLWPoly (list bl br tr tl) 1) ) )
    1 point
  11. Try this just change the file directory & name ; custom export mod and import text ; By AlanH Jun 2022 (defun c:ah:extxt ( / ) (setq ss (ssget '((0 . "*TEXT")))) (if (= ss nil) (alert "Something went wrong no text selected ") (progn (setq fo (open "D:\\acadtemp\\extxt.csv" "W")) (repeat (setq x (sslength ss)) (setq ent (entget (ssname ss (setq x (1- x))))) (setq txt (cdr (assoc 1 ent))) (setq hand (cdr (assoc 5 ent))) (write-line (strcat hand "," txt "," txt) fo) ) ) ) (close fo) (princ) ) (defun c:ah:intxt ( / ) ; thanks to Lee-mac for this defun ; www.lee-mac.com ; 44 is comma 32 is space . is 46 (defun _csv->lst ( strtxt / pos ) (if (setq pos (vl-string-position 44 strtxt)) (cons (substr strtxt 1 pos) (_csv->lst (substr strtxt (+ pos 2)))) (list strtxt) ) ) (setq fo (open "D:\\acadtemp\\extxt.csv" "R")) (while (setq nline (read-line fo)) (setq lst (_csv->lst nline)) (setq ent (entget (handent (nth 0 lst)))) (entmod (subst (cons 1 (nth 2 lst)) (assoc 1 ent) ent)) ) (close fo) (princ) )
    1 point
  12. Steven P have a look at this start with 1 = A then try 26 and 27 and so on. ;------------------------------------------------------------------------------- ; Number2Alpha - Converts Number into Alpha string ; Function By: Gilles Chanteau from Marseille, France ; Arguments: 1 ; Num# = Number to convert ; Syntax example: (Number2Alpha 731) = "ABC" ;------------------------------------------------------------------------------- (defun Number2Alpha (Num# / Val#) (if (< Num# 27) (chr (+ 64 Num#)) (if (= 0 (setq Val# (rem Num# 26))) (strcat (Number2Alpha (1- (/ Num# 26))) "Z") (strcat (Number2Alpha (/ Num# 26)) (chr (+ 64 Val#))) ) ) );defun Number2Alpha (Number2Alpha 1) (Number2Alpha 26) (Number2Alpha 27) (Number2Alpha 52)
    1 point
  13. What else will the cad operator do for the other 7.5 Hours but have a coffee. or something stronger.
    1 point
  14. That is what I said already 1st pass text file made from user picks. X,Y,TEXT 0,0,1-1-1,1-1-1 10,10,1-1-1,1-1-1 30,50,1-1-1,1-1-1 edited file X,Y,TEXT 0,0,1-1-1,1-1-1A 10,10,1-1-1,1-1-B 30,50,1-1-1,1-1-B Read file and update If you want to change X&Y then please say so now.
    1 point
  15. As you say if blocks are a mix then a problem. The solution appears to be 2 steps not one. You should be able to stop in your script, been a while, generally its no user input, any way a script can have lisp code in it or call a lisp program that program may have a stop and ask a question. Only a quick look but add set units.lsp to your Appload Start up suite then the functions will be available. remove the (command ".script" (strcat folderName "\\batchJob.scr")) in batchjob code. Your batchjob1.scr should be, (BatchJob) (command ".script" (strcat folderName "\\batchJob.scr")) The script needs (c:UNITSET) to be added after open dwg1 etc in batchjob I think that is what you need. Not tested. open dwg1 (c:UNITSET) close Y open dwg2 (c:UNITSET) close Y You dont need lee's bounding box can just load the boundingbox lisp as part of the script.
    1 point
  16. Look into CAL has 2 functions that may do what you are doing. Type 'cal then function plt(p1,p2,t) Calculate a Point on a Line (CAL Command) | AutoCAD 2020 | Autodesk Knowledge Network My old R2012 manual has pretty pictures.
    1 point
  17. Its easy enough to do but are we talking about one layer or multiple layers? if its multiple layers what layer goes where? Sorry you said object I was thinking blocks. ;;----------------------------------------------------------------------------;; ;; SWITCH LAYERS BETWEEN OBJECTS (defun C:SwapLayer (/ OA OB LA LB) (setq OA (car (entsel "\nSelect first object: ")) LA (cdr (assoc 8 (setq OA (entget OA)))) OB (car (entsel "\nSelect second object: ")) LB (cdr (assoc 8 (setq OB (entget OB)))) ) (if (eq LA LB) (prompt "\nBoth Entities are on same layer") (progn (entmod (subst (cons 8 LB) (assoc 8 OA) OA)) (entmod (subst (cons 8 LA) (assoc 8 OB) OB)) ) ) (princ) )
    1 point
  18. I'd also check that what you think are local variables are defined in the defun line - like MHUPP says, sounds like it is picking up a value from elsewhere when you are not expecting it to be. What happens if you open the drawing - no LISPs running - and run these ones straight off from the command line before you do anything else?
    1 point
  19. thx work perfect i did change it a little bit
    1 point
  20. I have moved your thread to the CUI, Hatches, Linetypes, Scripts & Macros Forum. I have a thread or two around somewhere explaining how that DIESEL works to modify the DWGNAME. If I get time, I'll see what I can find. What you want, may need LISP. Can you post some examples and a .dwg?
    1 point
  21. move text with equal spacing, perhap this -> subfoo ? for line, prefer redraw as LWPOLYLINE or DIMORDINATE (note: if -ve value, you need to override measurement) modify existing is tricky if just 'LINE'. for lwpolyline is easier if has typical number of vertices then can entmod -> example p/s: post a sample DWG
    1 point
×
×
  • Create New...