Jump to content

Leaderboard

  1. mhupp

    mhupp

    Trusted Member


    • Points

      8

    • Posts

      2,169


  2. ReMark

    ReMark

    Trusted Member


    • Points

      4

    • Posts

      46,317


  3. BIGAL

    BIGAL

    Trusted Member


    • Points

      3

    • Posts

      20,028


  4. pkenewell

    pkenewell

    Community Member


    • Points

      3

    • Posts

      772


Popular Content

Showing content with the highest reputation since 03/12/2026 in Posts

  1. 100% setenv is writing strings to your windows registry. not good if you are doing that for all variables. might want to check to see what else you have been writing there. HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R##.#\ACAD-####:###\Profiles\<<Unnamed Profile>>\Variables tho setenv will persist even after reboot. overkill for most variables need in lisp. like @pkenewell said you should be good with just global variables. that holds while the drawing is open but make them unique. if you need to hold a variable in the drawing itself. use ldata that will persist in the drawing. so you can close and reopen it.
    2 points
  2. Or using the method proposed by @Stefan BMR we could automate in lisp like this: (enter the distances when the cursor is on the tracking line to get the desired angles) (defun des_vec (lst col / lst_sg) (setq lst_sg (list (cadr lst) (car lst))) (setq lst (cdr lst)) (while lst (if (cadr lst) (setq lst_sg (cons (cadr lst) (cons (car lst) lst_sg))) ) (setq lst (cdr lst)) ) (setq lst_sg (cons col lst_sg)) (grvecs lst_sg) ) (defun c:pl90-45 ( / old_set p1 p2 lst_pt msg) (setq old_set (mapcar 'getvar '("GRIDMODE" "ANGDIR" "ANGBASE" "POLARANG" "POLARMODE" "AUTOSNAP" "SNAPANG" "ORTHOMODE"))) (initget 33) (setq p1 (getpoint "\nPick start point: ")) (initget 33) (setq p2 (getpoint p1 "\nReference start angle: ") lst_pt (list (list (car p1) (cadr p1))) msg "\nGive distanve in the direction of cursor: " ) (mapcar 'setvar '("GRIDMODE" "ANGDIR" "ANGBASE" "POLARANG" "POLARMODE" "AUTOSNAP" "SNAPANG" "ORTHOMODE") (list 0 0 (angle p1 p2) (* 0.25 pi) 3 2 (angle p1 p2) 1) ) (initget 303) (while (and (setq p2 (getpoint p1 msg)) (/= p2 "C")) (cond ((/= p2 "U") (setq p2 (list (car p2) (cadr p2))) (mapcar 'setvar '("AUTOSNAP" "SNAPANG" "ORTHOMODE") (list 10 (angle p1 p2) 0) ) (setq p1 p2 lst_pt (cons p2 lst_pt) msg "\nGive distanve in the direction of cursor or [C/U] for Close or Undo : " ) ) (T (setq lst_pt (cdr lst_pt) p1 (car lst_pt) ) ) ) (redraw) (des_vec lst_pt 7) (initget 302 "C U") ) (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") (cons 8 (getvar "CLAYER")) '(100 . "AcDbPolyline") (cons 90 (length lst_pt)) (if (= p2 "C") '(70 . 1) '(70 . 0)) ) (mapcar '(lambda (x) (cons 10 x)) lst_pt) ) ) (mapcar 'setvar '("GRIDMODE" "ANGDIR" "ANGBASE" "POLARANG" "POLARMODE" "AUTOSNAP" "SNAPANG" "ORTHOMODE") old_set) (prin1) )
    2 points
  3. fixed an error with substr to only remove the first char of the string. and added your + option.
    2 points
  4. @mhupp great code no reason why input could not be 7.7;-12;22.8;12;-5.9;21.6;-0.5;\3.5;8;2.5;\1.5;13.8 in this case each leg is separated by a semi colon, or more often a comma is used. Could type in say notepad and copy and paste to a getstring. The reason for the paste rather than type direct would be if made a mistake you UNDO fix in notepad and do again. Use "parse to list" defun. @Ataim what do you think about that idea ?
    2 points
  5. If I understand correctly your request, I think you can get the same with the right settings. Just aim the desired direction and specify the distance.
    2 points
  6. 1 point
  7. Yes - That's it! I looked at the drawing again, and the z dim was off by a very small amount! when I set z to zero on the entities - QLATTACH works.
    1 point
  8. I wonder if their is a Z difference that those commands error. many a "2D" Drawing iv been given has stuff like 100' above everything else.
    1 point
  9. @pmadhwal7 Looks like you had this same problem in 2019. MLEADERS were suggested to you then and you didn't try the tools offered? I did the following with a LEADER to MLEADER conversion very quickly:
    1 point
  10. @ScottMC I don't see the purpose of why you are cutting the circle, printing the coordinates to the command line, then pasting the circle in the same loop? - You don't need to initialize the pp variable as "" - There is not apparent reason to cut and paste the circle. - You do not need to put a Global variable into the registry to recall it again in the same session, even if the program stops. Try out the following code: (defun c:C2 (/ cr el *error* fp oe os p p2) (defun *error* (msg) (if oe (setvar "cmdecho" oe)) (if os (setvar "osmode" os)) (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) (princ (strcat "\n" msg)) ) (vla-startundomark (vla-get-activedocument (vlax-get-acad-object))) (setq oe (getvar "cmdecho") os (getvar "osmode") ) (setvar "cmdecho" 0) (while (and (setvar 'osmode (boole 7 os 512)) (setq fp (getpoint "\nSpecify 1st Point of 2P.Circle: ")) ) (command "._Circle" "_2P" "_non" fp) (setvar "osmode" OS) (princ "\nSecond Point: ") (while (= (logand (getvar "cmdactive") 1) 1) (command pause) ) (setq el (entget (entlast)) p (trans (cdr (assoc 10 el)) (cdr (assoc 210 el)) 1) p2 (getvar "lastpoint") cr (getvar "circlerad") ) (princ (strcat "\n Coordinates: " (setq C2:pp ;; Global Variable "C2:pp" (strcat (rtos (car p) 2 4) "," (rtos (cadr p) 2 4) "," (rtos (caddr p) 2 4) ) ) "\n Diameter: " (rtos (* cr 2) 2 4) "| Radius: " (rtos cr 2 4) "\n" ) ) (entmakex (list (cons 0 "POINT") (cons 10 p))) (entmakex (list (cons 0 "POINT") (cons 10 p2))) ) (setvar "cmdecho" oe) (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) (princ) )
    1 point
  11. I've been using already THANKS. I promise this might be my last change. Can you add +distsance just extend the last line that additional amount?
    1 point
  12. I was using /# and /-# but using / and \ works to. if the 45 still going the wrong way you just need to flip the first two wcmatch calls. right now line 17 ((wcmatch inp "\\*") line 26 ((wcmatch inp "/*") fix line 17 ((wcmatch inp "/*") line 26 ((wcmatch inp "\\*") PolyHouse.lsp
    1 point
  13. Was thinking that as well. would have to tinker with it for a bit. ended up adding an [U]ndo and [C]lose option. *can only use undo on last leg.
    1 point
  14. Should get you what your looking for. code below
    1 point
  15. Try this as a first pass, see if I have the idea right: Not quite as described and only draws lines as it is, rather than Polylines, but it being a Sunday and the CAD should be off it will do for a start, or if it inspires anyone tonight. To consider later: Fixing the loop - as it is just escape out of the LISP to end or join last point to start point. Join the lines together as Polylines (See Lee Mac PLJoin?) (defun c:testthis ( / Pta Ptb Pt1 Pt2 MyLine MyDistance MyAngle ed RefLine RefAngle ) (defun LM:roundm ( n m ) ;; Lee Mac ;; Round to nearest m (* m (fix ((if (minusp n) - +) (/ n (float m)) 0.5))) ) (command "line" pause pause "") ; Draw first segment (setq RefLine (entlast)) ; Line entitity name (setq Pta (setq Pt1 (cdr (assoc 10 (entget RefLine)))) ) ; First line start point (setq Ptb (setq Pt2 (cdr (assoc 11 (entget RefLine)))) ) ; first line end point (setq RefAngle (angle Pt1 Pt2) ) ; First line absolute angle (setq endloop "No") ; marker to keep loop going (while ; While loop (and (= endloop "No") ; Marker still 'no' (= (command "line" Pt2 pause "") nil) ; and user draws a line ) ; end and (setq ed (entget (entlast))) ; next segment entity name (setq Pt1 (cdr (assoc 10 ed))) ; next segment start point (also last one end point (Setq Pt1 Pt2) should also work (setq Pt2 (cdr (assoc 11 ed))) ; next segment end point (if (equal Pt2 Pta) ; If next segment end point = first segment start point (progn (princ "Closed Polyline") (setq Endloop "Yes") ; set end loop marker & end loop ) ; end progn (progn ; else (setq MyDistance (distance Pt1 Pt2)) ; Record next segment distance (setq MyAngle (LM:roundm (- (angle Pt1 Pt2) RefAngle) (/ pi 4) )) ; next segment angle relative to first segment, rounded to pi/4 (45 degrees) ; pi/4: 45 degree angles, pi/12 for 15 degrees (setq Pt2 (polar Pt1 (+ MyAngle RefAngle) MyDistance)) ; Calculate new PT from rounded angle (setq ed (subst (cons 11 Pt2) (assoc 11 ed) ed )) ; Modify the segment to perpendicular / 45 degree (entmod ed) ; update next segment ) ; end progn ) ; end if ) ; end loop (princ) ) ; end defun
    1 point
  16. Sorry, I've been out hiking. It appears to be correct. Question: Have you already calculated the location of the 80 ft. contour that occurs between the spot elevations of 88.9 and 93.8? There is also a 100 ft. contour and a 110 ft. contour that starts on the same grid line.
    1 point
  17. That's because you need to do something before issuing the oops command. I think there is a thread here differentiating oops and undo command.
    1 point
  18. Your points will fall on the grid lines not inside the boxes created by the grid lines.
    1 point
  19. In other words, you are having trouble understanding the concept of interpolation, correct? The mathematical interpolation of contours goes like this. Let's say we have two spot elevations A & B. A = 32.7 and B = 54.0. The distance between A & B = 50 feet. We want to know where our 40-foot contour would fall between spot elevations A & B. First obtain the total elevation difference. This is done by subtracting A from B. 54.0 minus 32.7 = 21.3. Next, we want the difference in elevation between our 40-contour interval and the nearest spot elevation which in this case is A or 32.7. That works out to be 7.3. Now we need to calculate the distance (let's call this "d") we need to go from spot elevation A to our 40-foot contour. That takes the form of: d/7.3=50/21.3 or d=7.3*50/21.3 = 7.3*2.347 = 17.13 or the distance, in decimal feet, to our 40-foot contour. Got all that? Good. Now go start interpolating.
    1 point
  20. If you ask the originator for the LISP file, that is the best way.
    1 point
  21. That's not going to happen on here. Did you read the entire thread? Why do you need it as a .lsp? Tell us what it does and maybe there is a non-.fas version?
    1 point
  22. If BIGAL's last post is not what you want, i.e. you want to "convert .fas to .lsp" as per your original post, then: Effectively what you're asking is the same thing as asking for someone to change the ACAD.EXE file into the .H & .CPP files which AutoDesk had hundreds of programmers create for them. That is usually (if not always) illegal! Most of us here are programmers (at least amateur), so we know just how much time / effort can go into a program. Some of our programs we "give-away" for free by simply posing the source LSP files (or other sources). However, if we want to make money out of our "work", we would generally not give away the source files. Thus we'd "compile" them into FAS/VLX/DLL/ARX/etc. so that they will still run but not be editable by the users. Now in most cases, if you see a FAS file and you don't have the original LSP file(s) - that means the creator didn't want you to have the LSP file(s). And if you dis-assemble the FAS it would be grounds for the creator to sue you. Therefore no-one here would do something like that for you. Firstly because we'd not want such to happen to our own products. Secondly, we don't want to get into trouble with others - especially on someone else's behalf. If you want to go further with this, please refrain from using this forum (or similar) for such. You would be better served in some Cracker (note a Hacker is not a Cracker) community - i.e. go play with the criminals making viruses, breaking security systems & cracking software licensing!
    1 point
  23. Around the world there is a thing called copyrite and a even bigger subject "software piracy". Having been involved in a commercial product thats why a FAS is used to stop illegal copying. You have your answer above contact the author !
    1 point
  24. What is the purpose behind your request? Have you contacted the person whose code you are interested in? I imagine that some programmers compile their code to protect it from being used in a manner they would find objectionable.
    1 point
  25. The FAS format is the compiled version of an AutoLISP file, and one can guess that the programmer had a good reason to don’t provide his/her routine in plain code. If you really need to have access to that code, then I believe that is better to contact the programmer then to attempt to de-compile his/her work.
    1 point
  26. Another method: (defun c:vpon ( / d s ) (vl-load-com) (if (setq s (ssget "_+.:S:E:L" '((0 . "VIEWPORT")))) (progn (setq d (vla-get-activedocument (vlax-get-acad-object))) (vla-put-mspace d :vlax-true) (vla-put-activeviewport d (vlax-ename->vla-object (ssname s 0))) ) ) (princ) ) And to 'deactivate': (defun c:vpoff ( ) (vla-put-mspace (vla-get-activedocument (vlax-get-acad-object)) :vlax-false) (princ) )
    1 point
  27. THIS CODE CONVERTING LEADER TO MLEADER AND I DIN'T REQUIRED MLEADER
    0 points
×
×
  • Create New...