Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/18/2023 in all areas

  1. @smallƑish Give this a try: (defun c:foo (/ d p s) ;; RJP » 2023-08-17 ;; Creates an elbow for two selected parallel polylines (cond ((and ;; (or (setq d (getdist "\nEnter pipe diameter:<10> ")) (setq d 10)) (setq s (ssget "_:L" '((0 . "LWPOLYLINE")))) ) (setq s (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))) (setq s (vl-sort s '(lambda (r j) (< (vlax-curve-getarea r) (vlax-curve-getarea j))))) (setq p (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget (car s))))) (setq d (distance (cadr p) (vlax-curve-getclosestpointto (cadr s) (cadr p)))) (setvar 'filletrad (* d 0.25)) (command "_.fillet" "_polyline" (car s)) (setvar 'filletrad (* d 1.25)) (command "_.fillet" "_polyline" (cadr s)) (setq p (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget (car s))))) (setq p (list (cadr p) (caddr p))) (foreach x p (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") (assoc 8 (entget (car s))) '(100 . "AcDbPolyline") '(90 . 2) (cons 10 x) (cons 10 (vlax-curve-getclosestpointto (cadr s) x)) ) ) ) ) ) (princ) ) *Updated code to calculate diameter automatically:
    2 points
  2. I asked because you mentioned my Align Text to Curve program in your post, which is unrelated to the Length & Area Field program. To prompt for object first, add the following between lines 254 & 255: (setq flg t) Revert any other modifications you have made.
    1 point
  3. It worked perfectly @exceed Thank you very much ! Thank you very much to those who comment.
    1 point
  4. This instance was to convert vector files with gradient hatches. I'll try it, I do sometimes need to get image files to vector. Exactly what I had to do for the example here was, I got the logos approved, but what ever company (companies) they were using couldn't use a .dwg or image files, they needed .svg or .ai or similar. The .dwg and several image types all didn't look very accurate when converted to vector in Illustrator, I ended up printing to PDF, importing the PDF into Illustrator and it only needed a little extra work. This example is just a portion of the entire logo. The .svg was too large to email so they used the .ai, AFAIK it worked okay, though. Basically, I get files so they can be used by companies to place logos, etc. on T-shirts, awards and other products (I think one similar to this was also used in a video). I have no clue why those companies can't just use the image file, nor do I know why the "bought and paid for" logos didn't come to the company as a vector file ( I actually completely made this particular one with instructions from the person wanting it completely in AutoCAD), but alas, I am just the lowly draftsman, they even turned down my request for Illustrator and Photoshop, so I have to send the files home and work on them. I need to learn to tell them no, not my problem. This particular one, the co-worker in charge of the project was particular in getting the shading spot on, so I had very little leeway in the results, and they needed to look the correct shades and colors when printed on paper. One of the posters they designed, the printing company messed up the colors and shading slightly on the first few. So any AutoCAD solution works for me. I do have a program "Pixel Extractor" by Highflybird, it is useful at times. Thank you!!
    1 point
  5. The following should work with a selection of any objects: (defun c:3dr ( / ang axs bpt idx ls1 ls2 lst obj pt1 pt2 sel ) (if (setq sel (ssget "_:L")) (progn (repeat (setq idx (sslength sel)) (if (and (setq obj (vlax-ename->vla-object (ssname sel (setq idx (1- idx))))) (vlax-method-applicable-p obj 'getboundingbox) (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'pt1 'pt2)))) ) (setq ls1 (cons (vlax-safearray->list pt1) ls1) ls2 (cons (vlax-safearray->list pt2) ls2) lst (cons obj lst) ) ) ) (if (and ls1 ls2) (progn (setq ang (/ pi 2.0) bpt (apply 'mapcar (cons '(lambda ( a b ) (/ (+ a b) 2.0)) (mapcar '(lambda ( a b ) (apply 'mapcar (cons a b))) '(min max) (list ls1 ls2)) ) ) ) (princ "\nRotate about [X/Y/Z] <Exit>: ") (while (setq axs (cdr (assoc (grread nil 10) '( ((2 120) 1.0 0.0 0.0) ((2 088) 1.0 0.0 0.0) ((2 121) 0.0 1.0 0.0) ((2 089) 0.0 1.0 0.0) ((2 122) 0.0 0.0 1.0) ((2 090) 0.0 0.0 1.0) ) ) ) ) (foreach obj lst (vlax-invoke obj 'rotate3d bpt (mapcar '+ bpt axs) ang) ) ) ) (princ "\nUnable to determine rotation base point.") ) ) ) (princ) ) (vl-load-com) (princ)
    1 point
×
×
  • Create New...