tgibbo Posted April 18, 2015 Posted April 18, 2015 Hi Everyone I have created a 4 sided polygon in the XY plane and want to extrude it in the Z direction I would like to know how to select the polygon for extrusion and the command for extruding in Z Thanks Quote
Lee Mac Posted April 18, 2015 Posted April 18, 2015 Here's a quick example: ([color=BLUE]defun[/color] c:test ( [color=BLUE]/[/color] cnt doc hgt lst ocs ply pnt reg spc ) ([color=BLUE]setq[/color] cnt 2) ([color=BLUE]if[/color] ([color=BLUE]car[/color] ([color=BLUE]setq[/color] lst ([color=BLUE]list[/color] ([color=BLUE]getpoint[/color] [color=MAROON]"\nSpecify point 1: "[/color])))) ([color=BLUE]progn[/color] ([color=BLUE]while[/color] ([color=BLUE]and[/color] ([color=BLUE]<[/color] cnt 5) ([color=BLUE]setq[/color] pnt ([color=BLUE]getpoint[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\nSpecify point "[/color] ([color=BLUE]itoa[/color] cnt) [color=MAROON]": "[/color]) ([color=BLUE]car[/color] lst)))) ([color=BLUE]setq[/color] lst ([color=BLUE]cons[/color] pnt lst) cnt ([color=BLUE]1+[/color] cnt) ) ([color=BLUE]redraw[/color]) ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( a b ) ([color=BLUE]grdraw[/color] a b -1)) ([color=BLUE]cons[/color] ([color=BLUE]last[/color] lst) lst) lst) ) ([color=BLUE]if[/color] ([color=BLUE]and[/color] ([color=BLUE]=[/color] cnt 5) ([color=BLUE]setq[/color] hgt ([color=BLUE]getdist[/color] [color=MAROON]"\nSpecify extrusion height: "[/color]))) ([color=BLUE]progn[/color] ([color=BLUE]setq[/color] ocs ([color=BLUE]trans[/color] '(0.0 0.0 1.0) 1 0 [color=BLUE]t[/color]) doc ([color=BLUE]vla-get-activedocument[/color] ([color=BLUE]vlax-get-acad-object[/color])) spc ([color=BLUE]vlax-get-property[/color] doc ([color=BLUE]if[/color] ([color=BLUE]=[/color] 1 ([color=BLUE]getvar[/color] 'cvport)) 'paperspace 'modelspace)) ply ([color=BLUE]vlax-invoke[/color] spc 'addlightweightpolyline ([color=BLUE]apply[/color] '[color=BLUE]append[/color] ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( x ) ( ([color=BLUE]lambda[/color] ( x ) ([color=BLUE]list[/color] ([color=BLUE]car[/color] x) ([color=BLUE]cadr[/color] x))) ([color=BLUE]trans[/color] x 1 ocs) ) ) lst ) ) ) ) ([color=BLUE]vla-put-elevation[/color] ply ([color=BLUE]caddr[/color] ([color=BLUE]trans[/color] ([color=BLUE]car[/color] lst) 1 ocs))) ([color=BLUE]vla-put-closed[/color] ply [color=BLUE]:vlax-true[/color]) ([color=BLUE]if[/color] ([color=BLUE]vl-catch-all-error-p[/color] ([color=BLUE]setq[/color] reg ([color=BLUE]vl-catch-all-apply[/color] '[color=BLUE]vlax-invoke[/color] ([color=BLUE]list[/color] spc 'addregion ([color=BLUE]list[/color] ply))))) ([color=BLUE]princ[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\nError creating region: "[/color] ([color=BLUE]vl-catch-all-error-message[/color] reg))) ([color=BLUE]progn[/color] ([color=BLUE]vla-addextrudedsolid[/color] spc ([color=BLUE]car[/color] reg) hgt 0.0) ([color=BLUE]vla-delete[/color] ([color=BLUE]car[/color] reg)) ) ) ([color=BLUE]vla-delete[/color] ply) ) ) ) ) ([color=BLUE]redraw[/color]) ([color=BLUE]princ[/color]) ) ([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color]) Quote
tgibbo Posted April 18, 2015 Author Posted April 18, 2015 Thanks Lee I am only a beginner and what you have written has lost me completely. Is it possible to only answer my question at this stage. No disrespect intended here but I really don't know much. Regards Tony Quote
troggarf Posted April 19, 2015 Posted April 19, 2015 Are you asking how to use the EXTRUDE command? http://knowledge.autodesk.com/support/autocad/learn-explore/caas/documentation/ACD/2014/ENU/files/GUID-85FD1106-8F10-4EE8-B0FB-99F1E3AEE405-htm.html Quote
Dadgad Posted April 19, 2015 Posted April 19, 2015 (edited) Thanks Lee I am only a beginner and what you have written has lost me completely. Is it possible to only answer my question at this stage. No disrespect intended here but I really don't know much. Regards Tony As you posted in the lisp forum, Lee is kindly trying to show you a way, and the ropes. As suggested by Troggarf, are you sure you really need a lisp to do that which the software already does pretty well, with the EXTRUDE command? The PRESSPULL command would be another OOTB option to do pretty much the same thing, but even easier. http://www.cadtutor.net/tutorials/autocad/extrude-and-press-pull/ If you try those really simple options, remember to READ the commandline prompts after starting the commands. Edited April 19, 2015 by Dadgad Quote
tgibbo Posted April 19, 2015 Author Posted April 19, 2015 My apologies on this one. I should have said at the start that I am putting together a lisp routine and part of it needs to extrude a polygon in the Z direction. I wasn't trying to recreate Autocad's Extrude command. Sorry to cause confusion Regards Tony Quote
Lee Mac Posted April 19, 2015 Posted April 19, 2015 I am only a beginner and what you have written has lost me completely. Is it possible to only answer my question at this stage. No disrespect intended here but I really don't know much. No worries Tony - What method are you using to create your polygon in the program? Quote
tgibbo Posted April 19, 2015 Author Posted April 19, 2015 Hi Lee I used setq/getpoint to create 4 points and then drew a closed polyline at the 4 points. That worked good. Then I wanted to extrude the closed polyline in the Z but I couldn't get the sequence of commands right for that. In the mean time while waiting for an answer a light went on in my head and told me to use the _BOX command. Bingo So now I can create my different size cubes in a few seconds. Quote
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.