Jump to content

Convert DONUT to wipeout DONUT


marko_ribar

Recommended Posts

It seems that this is only solution... Look here...

 

But my CAD Background is almost black, and white color is plotted as black, but color 255,255,255 which is also white is plotted like mask... I can't differentiate between white or black unless I don't change CAD Background color and white Background tires my eyes while working... So can this 255,255,255 color be set while plotting as white (paper is white) and in CAD environment to be seen as black 0,0,0...

Link to comment
Share on other sites

I've solved this problem successfully with this simple piece of code... Hope it will help and others as it helps me... I've put it into my startup suite...

 

(defun c:bhwipeout ( / adoc True->RGB ss i orlay lay bckmodcol rgb bound )

 (vl-load-com)
 (setq adoc (vla-get-activedocument (vlax-get-acad-object)))

 (defun True->RGB ( c )
   (mapcar '(lambda ( x ) (lsh (lsh (fix c) x) -24)) '(8 16 24))
 )
 
 (setq orlay (getvar 'clayer))
 (if (not (tblsearch "LAYER" "HATCH-WIPEOUT"))
   (setq lay (vla-add (vla-get-layers adoc) "HATCH-WIPEOUT"))
   (setq lay (vla-item (vla-get-layers adoc) "HATCH-WIPEOUT"))
 )
 (vla-put-plottable lay :vlax-false)
 (setq bckmodcol (vlax-variant-value (vlax-variant-change-type (vla-get-graphicswinmodelbackgrndcolor (vla-get-display (vla-get-preferences (vlax-get-acad-object)))) vlax-vbstring)))
 (setq rgb (reverse (true->rgb (atoi bckmodcol))))
 (command "_.layer" "_S" "HATCH-WIPEOUT" "_C" "_T" (strcat (itoa (car rgb)) "," (itoa (cadr rgb)) "," (itoa (caddr rgb))) "" "")
 (setvar 'clayer orlay)
 (setvar 'hpname "SOLID")
 (prompt "\nSelect boundary entities for wipeout hatches")
 (setq ss (ssget (append (list '(-4 . "<or") '(0 . "CIRCLE") '(-4 . "<and") '(0 . "*POLYLINE") '(-4 . "<not") '(-4 . "&=") '(70 .  '(-4 . "not>") '(-4 . "&=") '(70 . 1) '(-4 . "and>") '(-4 . "<and") '(0 . "SPLINE") '(-4 . "&=") '(70 . 1) '(-4 . "and>") '(-4 . "<and") '(0 . "ELLIPSE") '(41 . 0.0)) (list (cons 42 (* 2 pi))) (list '(-4 . "and>") '(0 . "REGION") '(-4 . "or>")))))
 (setq i -1)
 (while (setq bound (ssname ss (setq i (1+ i))))
   (if (>= (atof (substr (getvar "acadver") 1 4)) 18.0) (setvar 'hpcolor "255,255,255") (setvar 'cecolor "RGB:255,255,255"))
   (setvar 'clayer orlay)
   (command "_.draworder" bound "" "_F")
   (command "_.-bhatch" "_S" bound "" "")
   (setvar 'clayer "HATCH-WIPEOUT")
   (if (>= (atof (substr (getvar "acadver") 1 4)) 18.0) (setvar 'hpcolor "ByLayer") (setvar 'cecolor "ByLayer"))
   (command "_.-bhatch" "_S" bound "" "")
   (command "_.draworder" bound "" "_F")
 )
 (setvar 'clayer orlay)
 (princ)
)

Regards, M.R.

Edited by marko_ribar
code changed
Link to comment
Share on other sites

  • 3 years later...

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