Eranac Posted February 5, 2013 Posted February 5, 2013 (edited) Hello ! I have a lisp which work very well for somebody but it don't work for me. This lisp aim's at converting a two dimensional plan to a third dimensional plan of a flat with duct or sheath inside the flat. There is two polylines (one for the outside of the flat and one for the outside of the duct. The process is to set the elevation of polylines and extrude the polyline of the flat without the volume of the "duct" inside the flat. You can see it on this video : This is the lisp and I don't understand why I have message indicating me that the ssget function mode is wrong (defun c:ex-sub (/ sd s pts ss cm e ent i s1) ;;; ==-- Author : Tharwat Al Shoufi --== ;;; ;;; Extrude and extract inside polylines ;;; (vl-load-com) (or Doc (setq Doc (vla-get-ActiveDocument (vlax-get-acad-object)))) (setq *elv* (if *elv* *elv* 1.0 ) *ex* (if *ex* *ex* 1.0 ) ) (if (and (progn (initget 6) (setq *elv* (cond ((getdist (strcat "\n Specify Elevations " (strcat " < " (rtos *elv* 2 2) " > :")))) (t *elv*) ) ) ) (progn (initget 6) (setq *ex* (cond ((getdist (strcat "\n Specify extrusion height " (strcat " < " (rtos *ex* 2 2) " > :")))) (t *ex*) ) ) ) (setq sd (ssadd)) (setq s (car (entsel "\nSelect Single outside LWpolyline"))) (if (wcmatch (cdr (assoc 0 (setq e (entget s)))) "*POLYLINE") t (progn (princ "\n Your selection is not a polyline or nothing selected !!") nil) ) ) (progn (foreach pt e (if (eq (car pt) 10) (setq pts (cons (list (cadr pt) (caddr pt)) pts)) ) ) (if (setq ss (ssget "WP" pts '((0 . "*POLYLINE")))) (progn (vla-StartUndoMark Doc) (setq cm (getvar 'cmdecho)) (setvar 'cmdecho 0) (entmod (subst (cons 38 *elv*) (assoc 38 e) e)) (command "_.extrude" s "" *ex*) (setq s1 (entlast)) (repeat (setq i (sslength ss)) (entmod (subst (cons 38 *elv*) (assoc 38 (setq ent (entget (ssname ss (setq i (1- i)))))) ent)) (command "_.extrude" (ssname ss i) "" *ex*) (ssadd (entlast) sd) ) (command "_.subtract" s1 "" sd "") (setvar 'cmdecho cm) (vla-Endundomark Doc) ) ) ) (princ) ) (princ "\n Written by Tharwat Al Shoufi") (princ) ) Could you help me to find a solution ? Does it lisp work well for you ? Edited February 5, 2013 by Eranac Quote
GP_ Posted February 5, 2013 Posted February 5, 2013 The link to youtube does not work We await Tharwat. Quote
Tharwat Posted February 5, 2013 Posted February 5, 2013 The link to youtube does not work We await Tharwat. Hi GP , here is the link for the and please try the code and tell me back if it worked or not with you as shown in the video . Quote
Eranac Posted February 5, 2013 Author Posted February 5, 2013 Hello ! I have a lisp which work very well for somebody (all it's OK for Tharwat who writed it) but it don't work for me. This lisp aim's at converting a two dimensional plan to a third dimensional plan of a flat with duct or sheath inside the flat. There is two polylines (one for the outside of the flat and one for the outside of the duct. The process is to set the elevation of polylines and extrude the polyline of the flat without the volume of the "duct" inside the flat. You can see it on the video in the post of Tharwat. This is the lisp and I don't understand why I have message indicating me that the ssget function mode is wrong (defun c:ex-sub (/ sd s pts ss cm e ent i s1) ;;; ==-- Author : Tharwat Al Shoufi --== ;;; ;;; Extrude and extract inside polylines ;;; (vl-load-com) (or Doc (setq Doc (vla-get-ActiveDocument (vlax-get-acad-object)))) (setq *elv* (if *elv* *elv* 1.0 ) *ex* (if *ex* *ex* 1.0 ) ) (if (and (progn (initget 6) (setq *elv* (cond ((getdist (strcat "\n Specify Elevations " (strcat " < " (rtos *elv* 2 2) " > :")))) (t *elv*) ) ) ) (progn (initget 6) (setq *ex* (cond ((getdist (strcat "\n Specify extrusion height " (strcat " < " (rtos *ex* 2 2) " > :")))) (t *ex*) ) ) ) (setq sd (ssadd)) (setq s (car (entsel "\nSelect Single outside LWpolyline"))) (if (wcmatch (cdr (assoc 0 (setq e (entget s)))) "*POLYLINE") t (progn (princ "\n Your selection is not a polyline or nothing selected !!") nil) ) ) (progn (foreach pt e (if (eq (car pt) 10) (setq pts (cons (list (cadr pt) (caddr pt)) pts)) ) ) (if (setq ss (ssget "WP" pts '((0 . "*POLYLINE")))) (progn (vla-StartUndoMark Doc) (setq cm (getvar 'cmdecho)) (setvar 'cmdecho 0) (entmod (subst (cons 38 *elv*) (assoc 38 e) e)) (command "_.extrude" s "" *ex*) (setq s1 (entlast)) (repeat (setq i (sslength ss)) (entmod (subst (cons 38 *elv*) (assoc 38 (setq ent (entget (ssname ss (setq i (1- i)))))) ent)) (command "_.extrude" (ssname ss i) "" *ex*) (ssadd (entlast) sd) ) (command "_.subtract" s1 "" sd "") (setvar 'cmdecho cm) (vla-Endundomark Doc) ) ) ) (princ) ) (princ "\n Written by Tharwat Al Shoufi") (princ) ) Could you help me to find a solution ? Does it lisp work well for you ? Thanks to Tharwat for his help ! Quote
Eranac Posted February 5, 2013 Author Posted February 5, 2013 Yes, CarlAK find the solution on http://www.autolisp.com : Is it possible the ssget "wp" should be "_wp", something to do with different version/language of AutoCAD? http://www.autolisp.com/forum/threads/797-Lisp-to-extrude-polyline-with-elevation-and-duct-inside-the-polyline?p=2928#post2928 Thanks CarlAK, you had a good idea ! Thanks a lot Tharwat for your help ! I'm very grateful ! Quote
Tharwat Posted February 6, 2013 Posted February 6, 2013 Thanks a lot Tharwat for your help ! I'm very grateful ! You're welcome any time . Quote
GP_ Posted February 6, 2013 Posted February 6, 2013 Hi GP , here is the link for the and please try the code and tell me back if it worked or not with you as shown in the video . Work with "_WP" Quote
Tharwat Posted February 6, 2013 Posted February 6, 2013 Work with "_WP"[ATTACH=CONFIG]40118[/ATTACH] Correct , and it was solved before by Carl in THIS link . Thanks for your time , appreciated a lot . 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.