Leaderboard
Popular Content
Showing content with the highest reputation on 07/25/2022 in all areas
-
I wanted to make sure that the Latitude and Longitude will accurately translated to X and Y points for AutoCAD. When evaluating the variables after using the read function it only shows to the 4th decimal, but in reality it does store the correct information. I just spent all this time for nothing trying to reinvent the wheel! This post is nothing more than a warning or a reminder to other people doing the same2 points
-
Good day everyone! Have you ever been completely dumbfounded by your own ingenuity and stupidity at the same time? Mine involves data types.... I am very well aware that autolisp shortens floating point data to the 4th or 5th decimal (for display purposes), but still retains the full decimal number. So I've been trying to write a program that gets the geojson data from a server via an API call and then goes and draws the data in cad for you (which is now finished and working). After I translate the data to autolisp I use the read function to convert the string into lists.... this is where all the magic happened. While looking at the results after using the read function, I noticed that my Longitude and Latitude was shortened to 4 decimals. So I thought to myself I had to add \" to all the coordinates to force the read function to see it as a string, so while the data is still in string I had to add the \". I don't know if it is just me or if anyone else experienced this, but manipulating string data (that is actually in list shape already) is pretty difficult. So I converted the string into an ASCII list which I could then use to look for a pattern to find the coordinates and add the " to them. Program below.. I was very happy with the result and I decided to compare it with the just the read function and to my horror, the results were exactly the same and my method was far slower. So to any of you wondering - read will store your floating number! Don't be stupid like me! ;Example data ;(_t2 "type LineString coordinates ((26.083354482 -33.316154796) (26.083742548 -33.316186902) (26.0840749 -33.31621582) (26.084660183 -33.316272006))") (defun _t2 (datastr / datalist numlist pos prevpos gateop check prevchar gate firstchar gatecl) (defun _insertatpos ( ins pos lst / ctr ) (setq ctr -1) (apply 'append (mapcar '(lambda ( x ) (if (= pos (setq ctr (1+ ctr))) (list ins x) (list x))) lst)) ) (setq datalist (vl-string->list datastr) numlist (list 45 46 48 49 50 51 52 53 54 55 56 57) gateop (list 40) gatecl (list 41) pos 0) (foreach x datalist (if (member x gateop) (setq gate t) (if (and (member x gatecl) gate) (progn (if check (setq datalist (_insertatpos 34 pos datalist) pos (1+ pos))) (setq gate nil firstchar nil check nil) ) ) ) (if gate (progn (if (and (member x numlist) (member prevchar gateop))(setq firstchar t)) (if (and (member x numlist) firstchar) (progn (if (not (= prevpos (- pos 1))) (progn (setq datalist (_insertatpos 34 pos datalist) pos (1+ pos) prevpos pos check t) ) (setq prevpos pos) ) ) (if check (progn (setq datalist (_insertatpos 34 pos datalist) pos (1+ pos) check nil) ) ) ) ) ) (setq prevchar x pos (1+ pos)) ) (vl-list->string datalist) )1 point
-
Your basic math skills would be sufficient to get a job as an AutoCAD technician. If hired you would most likely start as an entry level computer aided draftsman and would be tasked with working off of sketches, redlines, or even basic CAD drawings done by an engineer to flesh out a concept/design. But as you point out much depends on what discipline you find yourself employed in. Do you have some idea, at this time, what particular field you might like to eventually work in? Some options are civil, structural, architectural, electrical, mechanical, hydro-geological, chemical, marine, environmental and industrial to name a few. Regarding Penn-Foster AutoCAD course. You'll get the basics by way of creating a subdivision layout, an industrial building, an electrical schematic, and such. They have recycled the same drawings for years without adding much in the way of new content. Their instructors are said to be mostly indifferent to their students often going days before answering a question if they answer at all. But there are a few people who have reported back that after completing the certificate course they were able to land a job.1 point
-
Thank you very much! works perfectly with this version too! Satisfy my curiosity...What does foo mean? Hello!1 point
-
Thinking of it like this might help: When you're in modelspace, you're drawing your building/phone/fuirniture/boat/road/whatever-it-is so you should draw in full size in units to that (millimeters, inches, meters, feet, miles, whatever's appropriate/conventional). When you're in paperspace, you're drawing the sheet of paper that you're going to print, so you should work in units appropriate to that (millimeters, inches, or fractions of inches, probably). When you're adding a viewport, you're adding a representation of your subject at a specific scale. HTH dJE1 point
-
Whoever was asking tat question is a genius! (with a bad memory, didn't remember that one) That will give the basis of a script process, needed a few tweaks to make it work - what that eventually grew into was never quite finished, it kept growing with new ideas, so never quite happy to post it online. For a LISP it is a decent start to update though1 point
-
AutoCAD doesn't play nice with multiple drawings and lisp. look into scripts1 point
-
Plain LISP will work only on the window that starts it. When you move the focus to another drawing, then that LISP doesn't move with you, so open drawing 2, you can't keep running LISP from drawing 1 in it. You can however look at script processes, Lee Mac and others have script editors, and you can look at that. So you start a script via drawing 1, but it is then the script that is running and not a LISP in drawing 1. This lets you shift between drawings, open, save and close them as required. So have a look at Lee Mac script editor or scriptpro, see if they will get you what you want1 point
-
Are all you wanting to do is output your cords to string? ;(setq lst '((26.083354482 -33.316154796) (26.083742548 -33.316186902) (26.0840749 -33.31621582) (26.084660183 -33.316272006))) (defun _foo (lst / strlst str) (foreach itm lst (setq strlst (cons (rtos (car itm) 2 9) strlst)) (setq strlst (cons (rtos (cadr itm) 2 9) strlst)) ) (setq strlst (reverse strlst)) (setq str "type LineString coordinates (") (while (> (length strlst) 2) (setq str (strcat str "(" (car strlst) " " (cadr strlst) ") ")) (setq strlst (cddr strlst)) ) (setq str (strcat str "(" (car strlst) " " (cadr strlst) "))")) (princ) ) (_foo lst) outputs "type LineString coordinates ((26.083354482 -33.316154796) (26.083742548 -33.316186902) (26.084074900 -33.316215820) (26.084660183 -33.316272006))"1 point
-
Create a pdf directory under current dwg location. Part of my plot routines yes does auto. ; check that pdf directory exists (setq dwgpre (strcat (getvar "dwgprefix") "\pdf")) (if (= (vl-file-directory-p dwgpre) nil) (vl-mkdir dwgpre) ) ..................... (setq dwgname (GETVAR "dwgname")) (setq lendwg (strlen dwgname)) (setq dwgname (substr dwgname 1 (- lendwg 4))) ........................................................ (setq pdfname (strcat dwgpre "\\" dwgname "-" (getvar "ctab") ".pdf" )) ; pdf name1 point
-
You are just scooching the blocks 0.5 to the right? If so you can change the insertion point rather than use the move command like so ( although if they have attributes entmod does some strange stuff ) (if (setq s (ssget "_X" '((0 . "INSERT") (2 . "*")))) (foreach blk (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq pt (mapcar '+ (assoc 10 (entget blk)) '(0 0.5 0 0))) (entmod (append (entget blk) (list pt))) ) )1 point
-
Only really glanced at the code. and saw 1178 multiple times thought they where all going to the same point. You can do it that way Here is another rather then making multiple selections this makes just one of all blocks wanted then uses cond to move them (setq SS (ssget "_X" '((0 . "INSERT") (2 . "CATA00000,CART_LV01,CART_LV02,CART_LV03,CATIDENTELEA0,CATREVBELA0") (410 . "Model")))) (foreach blk (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq blkname (cdr (assoc 2 (setq x (entget blk))))) (cond ((eq blkname "CATA00000") (setq pt (cdr (assoc 10 x))) (command "_.Move" blk "" pt '(0 0 0)) ) ((eq blkname "CART_LV01") (setq pt (cdr (assoc 10 x))) (command "_.Move" blk "" pt '(1178 10 0)) ) ((eq blkname "CART_LV02") (setq pt (cdr (assoc 10 x))) (command "_.Move" blk "" pt '(1178 152.5 0)) ) ((eq blkname "CART_LV03") (setq pt (cdr (assoc 10 x))) (command "_.Move" blk "" pt '(1178 140 0)) ) ((eq blkname "CATIDENTELEA0") (setq pt (cdr (assoc 10 x))) (command "_.Move" blk "" pt '(1178 10 0)) ) ((eq blkname "CATREVBELA0") (setq pt (cdr (assoc 10 x))) (command "_.Move" blk "" pt '(1178 140 0)) ) ) )1 point
-
Here's another, from my library: ;; Arc Endpoints - Lee Mac ;; Returns the endpoints of an Arc expressed in WCS (defun LM:ArcEndpoints ( ent / cen nrm rad ) (setq ent (entget ent) nrm (cdr (assoc 210 ent)) cen (cdr (assoc 010 ent)) rad (cdr (assoc 040 ent)) ) (mapcar (function (lambda ( ang ) (trans (mapcar '+ cen (list (* rad (cos ang)) (* rad (sin ang)) 0.0)) nrm 0) ) ) (list (cdr (assoc 50 ent)) (cdr (assoc 51 ent))) ) )1 point
-
There are also the curve-functions which you can feed an ename to: VLAX-CURVE-GETSTARTPOINT VLAX-CURVE-GETENDPOINT (if (setq e (car (entsel))) (progn (setq sp (vlax-curve-getstartpoint e)) (setq ep (vlax-curve-getendpoint e))) )1 point
-
My mail box thinks you're spam , well punk are you? (with the voice of Clint Eastwood ) Oh I thought you wanted all ents inside block updated... silly me... good news is nos problemos, the bad news is , dragons never know when to stop and just have to go over the top so its gonna take more time before I'm satisfied (not the youngest dragon on the block anymore ya know)1 point
-
1 point