Jump to content

Extrude polylines based on numbers of inside

Recommended Posts

In my drawing, 
there are many blocks around and it says how many floors they are inside. 
I want to extrude these blocks. 
But since they are so numerous, it takes a long time to do it one by one. 
I'm looking for a lisp to extrude these blocks according to the numbers written in them.
It also works to select polylines based on the numbers inside
I'm sorry for my bad english.



Edited by tahta07
Link to post
Share on other sites

Here's a start:

(defun c:foo (/ i n p s sp)
  ;; RJP » 2021-02-12
  (if (setq s (ssget ":L" '((0 . "*POLYLINE"))))
    (progn (setq sp (vlax-ename->vla-object (cdr (assoc 330 (entget (ssname s 0))))))
	   (vl-cmdf "_.UNDO" "Be")
	   (setvar 'cmdecho 0)
	   (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	     (setq p nil)
	     (repeat (fix (setq i (vlax-curve-getendparam e)))
	       (setq p (cons (vlax-curve-getpointatparam e i) p))
	       (setq i (1- i))
	     (if (and (setq i (ssget "_WP" p '((0 . "TEXT"))))
		      (> (setq n (atof (cdr (assoc 1 (entget (setq i (ssname i 0))))))) 0)
	       ;; Vl extrusion is not as editable?
	       (progn ;; (setq r (car (vlax-invoke sp 'addregion (list (vlax-ename->vla-object e)))))
		      ;; (vlax-invoke sp 'addextrudedsolid r (* 3 n) 0.)
		      (vl-catch-all-apply 'vl-cmdf (list "_.extrude" e "" (* 3 n)))
	   (vl-cmdf "_.UNDO" "End")
	   (setvar 'cmdecho 1)


  • Like 1
Link to post
Share on other sites
  • 1 month later...
47 minutes ago, tahta07 said:

Thank you sir its work 😍🤩

Glad to help 🍻

Link to post
Share on other sites

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.

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...