Jump to content

Recommended Posts

Posted (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 by Eranac
Posted

The link to youtube does not work

 

We await Tharwat. :)

Posted
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 . :)
Posted

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 !

Posted

Thanks a lot Tharwat for your help ! I'm very grateful ! :D

 

You're welcome any time . :)

Posted
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"

finger.gif

Posted
Work with "_WP"

[ATTACH=CONFIG]40118[/ATTACH]

 

Correct , and it was solved before by Carl in THIS link . :thumbsup:

 

Thanks for your time , appreciated a lot .

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...