Jump to content

Re-draw an object using polyline from nodes created by "divide" command


pryzmm

Recommended Posts

  • 3 weeks later...
  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • MSasu

    9

  • pryzmm

    8

  • Tharwat

    4

  • Lee Mac

    1

hi again guys,

 

i do not want to start another thread so i dig up my old one that is where it all started.

 

msasu had compile an excellent routine (see below) i have tested it several times in acad 2008 and 2009 (arch't) in a totally clean drawing environment (no drawing at all except the p-line i was testing the routine with) which execute perfectly, everything is smooth.

 

then i have added a few lines of code just to use my preferred "layer" in doing the wipeout, and when i tested it at my office work (messy drawings - cad 2009),, it just went through up to the end of the routine without any thing done, no errors too,,,,

 

im sure there must be something in the code that i messed up,, could anyone take a look,, im not too familiar with lisp just yet.

 

appreciate any help :)

 

 

code start here;;;

 

;
;created by: msasu 31-08-2010
;lwpolyline to wipeout routine
;
;
(defun c:PL2WO ( / OldOsmode MyPline NrNodes Param1st Param2nd ParamLen DefameSize theCounter )
(vl-load-com)
(setq OldOsmode (getvar "OSMODE"))
;;--
(setq oldlayer  (getvar "clayer")) 
;;--
(if (and (setq MyPline (car (entsel "\nSelect polyline: ")))
     (setq NrNodes (getint "\nNumber of vertexes: ")))
 (progn
  (setq MyPline (vlax-ename->vla-object MyPline))

  (setq Param1st   (vlax-curve-getStartParam MyPline)   ;parameter at start point
        Param2nd   (vlax-curve-getEndParam   MyPline)   ;parameter at end point
        ParamLen   (- Param2nd Param1st)                ;parametrical "length"
        DefameSize (/ ParamLen NrNodes))                ;size of defame

  (setq theCounter 0)
  (setvar "OSMODE" 0)
  (command "_PLINE")
  (repeat NrNodes
   (command (setq thePoint (vlax-curve-getPointAtParam MyPline (+ Param1st (* theCounter DefameSize)))))
   (setq theCounter (1+ theCounter))
  )
  (command "_Close")
;------------------------------- added code
(if (tblsearch "layer" "SF_FP-WIPEOUT")
          (command ".-layer" "set" "SF_FP-WIPEOUT" "")
          (progn
              (setq rgn (getvar "regenmode")) (setvar "regenmode"0)
;;--   
      (command ".-layer" "make" "SF_FP-WIPEOUT" "color" "254" "ltype" "m-dot" "" "")
              (setvar "regenmode" rgn)
          );progn
      );if
;------------------------------- end of added code

  (command "_WIPEOUT" "_P" (entlast) "_Y")

;restore orig variables
;;--
(setvar "clayer" oldlayer)
;;--
  (setvar "OSMODE" OldOsmode)
 )
)
(princ)
)

 

 

;;; also if you guys need to know the full story behind this lisp pls. feel free to read page 1,2-->> thxxx

Link to comment
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.

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