Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sweep one profile to multiple lines, polylines or spline all at once.

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
JoseMandirigma
321 Views, 3 Replies

Sweep one profile to multiple lines, polylines or spline all at once.

I am trying to render a 3D object and I want the lines to be visible in the final output. However, AutoCAD does not have a setting to do this, so I am considering converting my lines into solids. This will be time-consuming as it will require me to sweep multiple lines, polylines, and splines. If you could please provide me with an alternative solution that saves me time, I would be very grateful. Thank you.

3 REPLIES 3
Message 2 of 4

(defun c:shp-sweep-c ( / *adoc* shp ss i curve lay col shpn el ch )

  (or (not (vl-catch-all-error-p (vl-catch-all-apply (function vlax-get-acad-object) nil))) (vl-load-com))

  (alert "Firstly specify-select curve entities with possibly \"Previous\" input and then pick unit shape curve which is to be swept...")
  (vla-startundomark (setq *adoc* (vla-get-activedocument (vlax-get-acad-object))))
  (prompt "\nSelect curve entities to make sweeps with unit shape...")
  (setq ss (ssget '((0 . "*POLYLINE,LINE,SPLINE,ARC,CIRCLE,ELLIPSE,HELIX"))))
  (prompt "\nPick unit shape curve for sweep along selected curves : ")
  (while (not (ssget "_+.:E:S:L" (list '(-4 . "<or") '(-4 . "<and") '(0 . "*POLYLINE") '(-4 . "<or") '(70 . 1) '(70 . 3) '(70 . 5) '(70 . 9) '(70 . 13) '(70 . 129) '(70 . 131) '(70 . 133) '(-4 . "or>") '(-4 . "and>") '(-4 . "<and") '(0 . "SPLINE") '(-4 . "<or") '(70 . 3107) '(70 . 2051) '(70 . 1067) '(70 . 11) '(-4 . "or>") '(-4 . "and>") '(-4 . "<and") '(0 . "ELLIPSE") '(-4 . "<and") '(41 . 0.0) '(42 . 6.28319) '(-4 . "and>") '(-4 . "and>") '(0 . "CIRCLE,REGION") '(-4 . "or>"))))
    (prompt "\nEmpty sel.set... Please pick unit shape for sweep along curves again...")
  )
  (setq shp (ssname (ssget "_P") 0))
  (setq sss (ssadd) el (entlast))
  (if ss
    (repeat (setq i (sslength ss))
      (setq curve (ssname ss (setq i (1- i))))
      (setq lay (cdr (assoc 8 (entget curve))))
      (setq col (vla-get-color (vlax-ename->vla-object curve)))
      (setq shpn (vlax-vla-object->ename (vla-copy (vlax-ename->vla-object shp))))
      (vl-cmdf "_.SWEEP" shpn "" curve)
      (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
      (entupd (cdr (assoc -1 (entmod (subst (cons 8 lay) (assoc 8 (entget (entlast))) (entget (entlast)))))))
      (vla-put-color (vlax-ename->vla-object (entlast)) col)
    )
    (prompt "\nEmpty sel.set... Please select curve entity(ies) next time when routine is started again...")
  )
  (if (= "Yes" (if (null (progn (initget "Yes No") (setq ch (getkword "\nDo you want to remove path curves [Yes/No] <Yes> : ")))) "Yes" ch))
    (progn
      (vl-cmdf "_.ERASE" ss "")
      (while (setq el (entnext el))
        (ssadd el sss)
      )
      (prompt "\nNewly created 3DSOLIDS are selected in selection set in variable \"sss\"... You can call it with (c:sss)")
      (sssetfirst nil sss)
    )
    (progn
      (prompt "\nSelection set with path curves is highlighted...")
      (sssetfirst nil ss)
    )
  )
  (vla-endundomark *adoc*)
  (princ)
)
Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 3 of 4

work flawlessly. thank you so much.

Message 4 of 4

Hi,

Is it possible to provide set base point of the profile ?

thanks in advance

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost