kulfi Posted April 2, 2014 Share Posted April 2, 2014 I have attached a 3dpolyline drawing coming from Utility Design i want to extrude this along its path and make it a 3d solid Pipe, Please let me know or if i can get the code is better defun c:3DS() (Setq Ss_Set (ssget "X" '((0 . "Polyline")))) (setq Ss_Length (sslength Ss_Set)) (setq count 0) (repeat Ss_Length (setq Ent (ssname Ss_Set count)) (setq Ent_Data (entget Ent)) ;(setq U1 (CDR (ASSOC 10 Ent_DATA))); i have the problem here how can i get the start Point ;(setq U2 (CDR (ASSOC 11 Ent_DATA))); i have the problem here how can i get the End Point (COMMAND "CLAYER" P-LAYER) (COMMAND "UCS" "W") (SETQ SNAP1 (GETVAR "OSMODE")) (SETQ APERTURE-1 (GETVAR "APERTURE")) (COMMAND "OSMODE" 5) (COMMAND "APERTURE" 4) (initget 1) (setq U1 (CDR (ASSOC 10 Ent_Data))) ;(setq u1 (getpoint "\nSelect From: ") (initget 1) (setq U2 (CDR (ASSOC 11 Ent_Data))) ;(setq u2 (getpoint "\nSelect To: ") (initget 7) (setq circ_dia (getreal "\nCicle diameter: ")) (COMMAND "UCS" "ZAXIS" U1 U2) (setq u3 (TRANS U1 0 1)) (COMMAND "CIRCLE" U3 "D" circ_dia) (setq ent (entlast)) ;(command "erase" ent ) (COMMAND "UCS" "W") (command "extrude" ent "" U1 U2 "") (COMMAND "CLAYER" "0") (COMMAND "OSMODE" SNAP1) (COMMAND "APERTURE" APERTURE-1) (COMMAND "UCS" "W") (PRINC) (setq count (+ 1 count)) ) Thanks Extrude.dwg Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 2, 2014 Share Posted April 2, 2014 Were you aware that someone already wrote separate lisp programs to extrude both pipe (solid) and tube? Look for the routines XPIPE.lsp and XTUBE.lsp by former member ASMI. Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted April 2, 2014 Share Posted April 2, 2014 (edited) I've modified your code... HTH, M.R. (defun c:3DSWEEP ( / getvertices SNAP1 APERTURE-1 DELO Ss_Set Ss_Length count circ_dia Ent Ent_Ptlst U1 U2 U3 ci ) (defun getvertices ( pl / unique fl e p1 p2 plst ) (vl-load-com) (defun unique ( l f ) (if l (cons (car l) (unique (vl-remove-if '(lambda ( x ) (equal x (car l) f)) (cdr l)) f)) ) ) (if (eq (cdr (assoc 100 (reverse (entget pl)))) "AcDb2dPolyline") (progn (command "_.convertpoly" "_L" pl "") (setq fl t) ) ) (setq e (entlast)) (if (entnext e) (while (not (eq (cdr (assoc 0 (entget (setq e (entnext e))))) "SEQEND"))) ) (vla-explode (vlax-ename->vla-object pl)) (while (setq e (entnext e)) (setq p1 (vlax-curve-getstartpoint e)) (setq p2 (vlax-curve-getendpoint e)) (setq plst (cons p1 plst)) (setq plst (cons p2 plst)) (entdel e) ) (if fl (command "_.convertpoly" "_H" pl "")) (setq plst (reverse plst)) (unique plst 1e-3) ) (setq SNAP1 (getvar "OSMODE")) (setq APERTURE-1 (getvar "APERTURE")) (setq DELO (getvar "DELOBJ")) (setvar "OSMODE" 0) (setvar "APERTURE" 4) (setvar "DELOBJ" 1) (prompt "\nSelect POLYLINE(s) for sweep processing") (Setq Ss_Set (ssget '((0 . "*POLYLINE")))) (setq Ss_Length (sslength Ss_Set)) (setq count 0) (prompt "\nCicle diameter <") (princ (* (getvar "CIRCLERAD") 2.0)) (prompt "> : ") (initget 6) (setq circ_dia (getdist)) (if (eq circ_dia nil) (setq circ_dia (* (getvar "CIRCLERAD") 2.0)) ) (COMMAND "_.UCS" "_W") (repeat Ss_Length (setq Ent (ssname Ss_Set count)) (setq Ent_Ptlst (getvertices Ent)) (setq U1 (car Ent_Ptlst)) (setq U2 (cadr Ent_Ptlst)) (if (tblsearch "LAYER" "P-LAYER") (setvar "CLAYER" "P-LAYER") ) (COMMAND "_.UCS" "_ZAXIS" U1 U2) (setq U3 (TRANS U1 0 1)) (COMMAND "_.CIRCLE" U3 "D" circ_dia) (setq ci (entlast)) (COMMAND "_.UCS" "_P") (COMMAND "_.EXTRUDE" ci "" "_P" Ent) ;;;;(entdel Ent) ;;;; => if you want to keep original 3dpolyline paths, just uncomment this line ;;;; (setq count (1+ count)) ) (setvar "CLAYER" "0") (setvar "OSMODE" SNAP1) (setvar "APERTURE" APERTURE-1) (setvar "DELOBJ" DELO) (COMMAND "_.UCS" "_P") (PRINC) ) Edited April 2, 2014 by marko_ribar Quote Link to comment Share on other sites More sharing options...
kulfi Posted April 3, 2014 Author Share Posted April 3, 2014 Now with connection to the previous problem where we had a 3dpolyline to convert to 3d solid now if i have a square or rectange object and i want to extrude to the same path how will i do that. thanks Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted April 4, 2014 Share Posted April 4, 2014 Now with connection to the previous problem where we had a 3dpolyline to convert to 3d solid now if i have a square or rectange object and i want to extrude to the same path how will i do that.thanks On my machine 3DSWEEP.lsp works and for squares or rectangles... Have you checked this? Quote Link to comment Share on other sites More sharing options...
kulfi Posted April 4, 2014 Author Share Posted April 4, 2014 How do you actually give the width length and depth parameters to extrude along the poly line. thanks Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted April 4, 2014 Share Posted April 4, 2014 Sorry, I thought you were asking for square, rectangle as path and not shape for extrude along path... Have you tried original SWEEP Command... It's also simple but powerful, just draw shape you wish, pick desired base point and then at the end select sweeping path along which sweep operation should be performed... Quote Link to comment Share on other sites More sharing options...
kulfi Posted April 5, 2014 Author Share Posted April 5, 2014 For drawing a rectangle shape or square shape I should have automated process like pipe before if that is there it is more feasible. thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.