Jump to content

Leaderboard

Popular Content

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

  1. My code draws the center line. Tharwat's code wraps it. My code should just polyline edit -> join them
    1 point
  2. @ajithkumar.t I recommend you try using the (vla-Saveas) method: ;; Use VlaSaveAs Method (setq saveFileName (strcat saveFileNamepath (vl-filename-base (getvar "DWGNAME")) ".dxf")) (vla-saveas (vla-get-activedocument (vlax-get-acad-object)) SaveFileName ac2018_dxf) (if (findfile SaveFileName) (prompt (strcat "\nProcessed drawing saved to: " saveFileName)) (prompt (strcat "\nError: Unable to save the processed drawing as DXF.")) ) Also note: you have some incomplete code in your post above: (setq subfolderName (strcat (rtos x 2 2) "-" modtext)) There is nothing in the function that defines "x" or "modtext" so it errors here.
    1 point
  3. Hey, that's a fun problem to try to solve. I got part of the solution. - Command DFT (for Draw Flexible Tube) - Select point 1 - Select point 2 - Select point 3 ... as shown on the picture ;; https://www.cadtutor.net/forum/topic/79564-shortest-polyline-between-two-flanges/ ;; @file (defun r2d (r / ) (/ (* r 180.0) pi) ) (defun d2r (d / ) (* (/ d 180.0) pi) ) ;; midpoint of 2 given points (defun mid ( pt1 pt2 / ) (mapcar '(lambda (x y) (+ (* 0.5 x) (* 0.5 y))) pt1 pt2 ) ) (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)))) (defun drawLine (p1 p2) (entmakex (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2)))) ;; command DFT, for Draw Flexible Tube (defun c:DFT ( / p1 p2 pm p3 duct_diam ang1 ang2 kink1 kink2 pl1 pl2 pl3 fillet1 fillet2) (setq p1 (getpoint "\nPoint 1 (right edge of the base): ")) (setq p2 (getpoint p1 "\nPoint 2 (left edge of the base): ")) (setq pm (mid p1 p2)) (setq duct_diam (distance p1 p2)) ;; read angle. minus 90°, that's the angle of the first vertex of the duct (setq ang1 (- (angle p1 p2) (d2r 90.0))) (princ (r2d ang1)) (princ "\nDuct diameter: ") (princ duct_diam) (princ " - angle: ") (princ (r2d ang1)) (setq p3 (getpoint "\nPoint 3: (middle of the top): ")) ;; step 1, we need a point perpendicular to p1-p2, length = distance p1-p2 (setq kink1 (polar pm ang1 duct_diam)) ;; dito for endpoint. I assume the top is always horizontal (setq kink2 (polar p3 (d2r -90.0) duct_diam)) ;; We draw 3 lines. (setq pl1 (drawLine pm kink1)) (setq pl2 (drawLine kink1 kink2)) (setq pl3 (drawLine kink2 p3)) ;; now fillet (setvar "FILLETRAD" duct_diam) (command "_.fillet" pl2 pl1) (setq fillet1 (entlast)) (command "_.fillet" pl2 pl3) (setq fillet2 (entlast)) (princ) )
    1 point
  4. Here you go. (defun c:Wrap (/ int sel ent obj) ;;----------------------------------------------------;; ;; Author : Tharwat Al Choufi ;; ;; website: https://autolispprograms.wordpress.com ;; ;;----------------------------------------------------;; (and (or (tblsearch "LAYER" "MF_Flexo") (alert "Please create a layer name < MF_Flexo > in prior to process.!") ) (princ "\nSelect center 'polyline' of Flexible duct : ") (setq int -1 sel (ssget "_:L" '((0 . "LWPOLYLINE")))) (while (setq int (1+ int) ent (ssname sel int)) (setq obj (vlax-ename->vla-object ent)) (mapcar (function (lambda (v / o) (setq o (car (vlax-invoke obj 'Offset v))) (vla-put-layer o "MF_Flexo") (vla-put-linetype o "ByLayer") (vla-put-Color o 256) ) ) '(79.5 -79.5) ) ) ) (princ) ) (vl-load-com)
    1 point
  5. We have used plot range for years very successfully, the bigegst for us was 88 layouts in one go, also had plot A1 and so on. I have a sneaky idea Ghostscript writes to the registry, yes individual pdf files, you make a list of pdf files, and pass that list to Ghostscript. Just look at code. I have moved Ghostscript on a disk but can not remember if it worked, if you can say install at home and copy from USB to drive C : or D : and correct GS folder, try it.
    1 point
  6. Using the 2024 wizard should work fine, the modules should load just fine in 2021, that will change in 2025. Also, you can create your own templates once you get up to speed
    1 point
  7. Another: (defun c:foo (/ n p s) (if (setq s (ssget '((0 . "LWPOLYLINE")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq n 0) (while (setq p (vlax-curve-getpointatparam e n)) (entmakex (list '(0 . "POINT") (cons 10 p))) (setq n (+ n 0.5)) ) ) ) (princ) )
    1 point
×
×
  • Create New...