Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/21/2024 in all areas

  1. I haven't tried LISP, but some of the programming languages have IDE's and Code Editors that practically write your code for you, at least helping finish and autocomplete with syntax, etc. I am guessing that's what AI is doing pretty much adapting written instructions to appropriate IDE and letting that finish it up. Most AI programmers probably not knowledgeable in AutoLISP, VLISP so might be a learn as LISP gets asked and corrected would be my guess. Looks like they aren't working for me at work as per the recent CoPilot thread.
    1 point
  2. Here is my code using since 2023 ;writen by eng motee malazi syria latakia 2023 ;email motee.z222@gmail.com (defun c:rsec (/ n e ang p0 nsecond thirdp nch) (setq clyr(getvar"clayer")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun objco ( enx ) (cond ((cdr (assoc 62 enx))) ((abs (cdr (assoc 62 (tblsearch "layer" (cdr (assoc 8 enx))))))) ) ) (setq e(car(entsel"\n pick any line to get its color to apply on text"))) (redraw e 3) (setq colrv (objco (entget e))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (if(null txth) (setq txth 1.25)) (setq txthnew(getreal(strcat"\n enter text height<sc:1/1000-txth=2.5;sc:1/500-txth=1.25;sc:1/200-txth=0.5>:" "<" (rtos txth 2 2)">:"))) (if txthnew(setq txth txthnew)) (if(null scrt) (setq scrt 10)) (setq scrtnew(getreal(strcat"\n enter scale ratio(vertical/horizental)" "<" (rtos scrt 2 2)">:"))) (if scrtnew(setq scrt scrtnew)) (setq factr(* 6.1 txth)) (if(null dh) (setq dh 0)) (setq dhnew (getreal(strcat"\n enter datum level:""<"(rtos dh 2 0)">:"))) (if dhnew(setq dh dhnew)) (setq dh1(abs dh)) (setq c0 0) (initget 1) (setq p0 (getpoint "\click on intersection of center line and datum line")) (while (setq blp(getvar"blipmode")) (setq osmd (getvar"osmode")) ;(initget 1) (setq n (getpoint "\n choose apoint to write its elevation and chainage")) (setq nsecond(getpoint n"\n pick direction")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (if(< (cadr nsecond)(cadr n)) (setq ang (/(* 3 pi)2)) (setq ang (/ pi 2)) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq nch(polar nsecond(- ang (* pi 0.5))txth)) (setq thirdp(polar nsecond ang (* 6 txth))) ;;;;;;;;;;;;;;;;;;;added ;;;;;;;;;;;;;;;;;;;;;;;;ncreat ch at p (entmakex (list '(0 . "TEXT") '(100 . "AcDbEntity") '(67 . 0) '(8 . "p-Elevation") '(100 . "AcDbText") (cons 10 nsecond) (cons 40 txth) (cons 1 (rtos(+ dh(/(-(cadr n)(cadr p0))scrt))2 3)) (cons 50 ang) '(41 . 1.0) '(51 . 0.0) (cons 62 colrv) '(7 . "Standard") '(71 . 0) '(72 . 0) ;(cons 11 (list 0.0 0.0 (last p))) '(100 . "AcDbText") '(73 . 0) ) ) ;;;;;;;;;;;;mmmmmmmmmmmmmmmmmmmmmmmm (entmakex (list '(0 . "TEXT") '(100 . "AcDbEntity") '(67 . 0) '(8 . "chainagep") '(100 . "AcDbText") (cons 10 nch) (cons 40 txth) (cons 1 (strcat"c:"(rtos (+(-(car n)(car p0))c0) 2 2))) (cons 50 ang) '(41 . 1.0) '(51 . 0.0) (cons 62 7) '(7 . "Standard") '(71 . 0) '(72 . 0) ;(cons 11 (list 0.0 0.0 (last p))) '(100 . "AcDbText") '(73 . 0) ) ) ;;;;;;;;;;;;mmmmmmmmmmmmmmmmmmmmmmmm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (command "layer" "m" "dashi" "c" "8" "" "L" "continuous" "" "LW" "0.18" "" "") (command"layer" "s" "dashi" "") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (command"_pline" n nsecond thirdp"") (setvar"clayer"clyr) ))
    1 point
  3. There is a song that says "Baby did a bad, bad thing..." I went over to an ai website and asked some questions and it eventually returned this working code... (Probably not the most efficient code but it is working in all my situations) (defun c:foo(/ blockNames foundBlocks insertBlock) ;; Define the blocks to check (setq blockNames '("BLOCKA" "BLOCKB" "BLOCKC") foundBlocks '() insertBlock "") ;; Check for each block's presence in the drawing (foreach blk blockNames (if (tblsearch "BLOCK" blk) (setq foundBlocks (cons blk foundBlocks)) ) ) ;; Determine action based on found blocks (cond ;; If more than one block is found ((> (length foundBlocks) 1) (princ "\nMore than one block found - Exiting...") ) ;; If exactly one block is found ((= (length foundBlocks) 1) (setq insertBlock (cond ((equal (car foundBlocks) "BLOCKA") "Block1") ((equal (car foundBlocks) "BLOCKB") "Block2") ((equal (car foundBlocks) "BLOCKC") "Block3") ) ) ;; Insert the block at the origin (0,0) (if (tblsearch "BLOCK" insertBlock) (command "_.-INSERT" insertBlock '(0 0) "1" "1" "0") (princ (strcat "\nBlock \"" insertBlock "\" not found in the drawing.")) ) ) ;; If no blocks are found (T (princ "\nNo blocks found.") ) ) (princ) ) My success rate using ai has been about 10% or less in the past.. so I gave up trying to use that method.. I got lucky I suppose. I still thank each and every one of you for your assistance.
    1 point
  4. Maybe another. Then look at X & Y work out direction. (setq pt1 (getpoint "\nPick 1st point ")) (setq pt2 (getcorner pt1 '\nPick second point "))
    1 point
  5. Works most of the time - haven't had time to work out why tonight but looks promising, thanks
    1 point
  6. Your are right, I think that an '(OR it's a good boleeann opération to include in the test. for can be T is returned. Thank, I let to anyone to add this condition.
    1 point
  7. Another comment if the objects are in metres then 5 would be correct, for mm 0.005. In Autocad turn on the viewports toolbar this has a little box that indicates current scale so we set our title block to true size eg A1 820x570 when measured, then a mview inside that, if you zoom making the objects say close to fitting the mview, in the box will be a number you should see like 4.678, change to 5, 6.1 change to 5 or 10 and so on. Hope it makes sense. Scales 1000/x 1000/200=5
    1 point
  8. I had this, I have cleaned up, IIRC it works pretty similar if not exactly like the old Softdesk Continuous Copy. ;;; Allows you to copy objects multiple times at a typed in distance and angle. | ;;; | ;;; |ContCop.lsp| similar to SoftEngine command Continuous Copy | ;;; | ;;; https://www.cadtutor.net/forum/topic/89869-continuous-copylsp/#comment-648783 | ;;; | ;;; By SLW210 (Steve Wilson) | ;;; | ;;;_________________________________________________________________________________________| ;;; | ;;; August 18th, 2024 | ;;; | ;;; | ;;; | ;;; | ;;;_________________________________________________________________________________________| ;;; | ;;; | (defun C:ContCop (/ ss ang dist dists temp pt1 pt2 oldOsnap) ;; Error handler for internal errors (defun ccerr (st) (if (or (/= st "Function cancelled") (= st "quit / exit abort")) (princ (strcat "\nError: " st)) ) (princ) ) ;; Set the error handler (setq *error* 'ccerr) ;; Store current Osnap setting (setq oldOsnap (getvar "OSMODE")) ;; Prompt user to select objects (prompt "\nSelect objects to copy: ") (command "select" "auto" pause) (setq ss (ssget "p")) ;; Prompt user to select the start and end points (initget 1) (setq pt1 (getpoint "\nSelect Start Point: ")) (initget 1) (setq pt2 (getpoint pt1 "\nSelect End Point: ")) ;; Calculate distance and angle (setq dist (distance pt1 pt2) ang (angtos (angle pt1 pt2) 0 6) dists 0.0 ) ;; Main loop for continuous copying (while (/= (setq temp (getdist (strcat "\nNext distance/Exit < " (rtos dist) " >: ") ) ) "Exit" ) (setq dists (+ dists (if (not temp) dist temp ) ) ) (setq temp (strcat "@" (rtos dists 2 6) "<" ang)) (command "COPY" ss "" "0,0" temp) ) ;; Restore original Osnap setting (setvar "OSMODE" oldOsnap) (princ) ) I am positive the others are better, but I need the practice, hopefully commented correctly for you and me both.
    1 point
  9. You have not mentioned what units you are using in your drawing. I am guessing that you would be using metre units. The AutoCAD default metric plotting units are millimetres. This means that a scaling of 1000 has to be introduced into the working somewhere. If you have used a custom scale of 0.005 in Layout and your design appears very small, then alter the custom scaling to 0.005 x 1000= 5 and see what that looks like. Another way of getting a scale is to try plotting to fit, and then alter the scaling, that is shown, to be a round number. Otherwise, post your drawing and someone can have a proper look at how it is set up.
    1 point
  10. Its just maths 1 min = 60 secs 1 sec = 360 etc just keep taking the FIX of the decimal and moving it. 30d 30' 30" = 30.50833333 so fix = 30 rem = .508333 * 60 = 30.49999 fix = 30 mins rem = .499999 * 60 = 29.999999 secs
    1 point
  11. You could use a combination of angtof & angtos.
    1 point
×
×
  • Create New...