Jump to content

solid hatch closed areas of drawing


Barry_47

Recommended Posts

Is Some one here to help me or can write program for me.

as in my daily work of drafting i have to solid hatch closed areas of drawing. and they are plenty in figures. with are in diffrent colour of boundries.

is any one can help me to fill that closed boundry with its boundry colour. it will help me to boost my productiviry.

if any lisp routine to recognize its boundry colour to fill in solid. it will be very much helpful to my daily work.

thank you.

Link to comment
Share on other sites

  • Replies 35
  • Created
  • Last Reply

Top Posters In This Topic

  • Barry_47

    14

  • Tharwat

    13

  • ReMark

    4

  • stevesfr

    2

Two examples . Easy to add layer etc as well.

 

(defun C:hatchcol1 ( / obj hatcol)
(vl-load-com)
(setq obj (car (entsel)))
(setq hatcol (vlax-get-property (vlax-Ename->Vla-Object obj) 'color))
(setvar "HPNAME" "Solid") ;set hatch pattern
(command "-Hatch" "S" obj "" "CO" hatcol "" "")
)

;inside objects

(defun C:hatchcol2 ( / obj hatcol pt)
(vl-load-com)
(princ "\nPlease pick object for color")
(setq obj (car (entsel)))
(setq hatcol (vlax-get-property (vlax-Ename->Vla-Object obj) 'color))
(setq pt (getpoint "\nPlease pick inside objects"))
(setvar "HPNAME" "Solid") ;set hatch pattern
(command "-Hatch" pt "" "CO" hatcol "" "")
)

Link to comment
Share on other sites

thank you BIGAL

it works nicely but it wont recognise its boundry colour. because all closed boundry colours are diffrent.

if it recognise it then it boost my productivity 200%.

thanks you once again. i dont know how to load sample drawing.

Link to comment
Share on other sites

Try this Barry and let me know :)

 

Note: if you do not want to select objects by a user , just change the mode string "_:L" to "_X" in the following codes .

 

(defun c:Test (/ *error* v l ss doc)
 ;;    Tharwat 20. Aug. 2014                        ;;
 ;; Hatching closed objects with Solid pattern        ;;
 ;; with respect to the color of the objects        ;;
 (defun *error* (x)
   (if v
     (mapcar 'setvar '(HPNAME CMDECHO) v)
   )
   (if (wcmatch (strcase x) "*BREAK*,*CANCEL*,*EXIT*")
     (princ (strcat "\n** Error: " x " **"))
   )
 )
 (setq l (entlast)
       v (mapcar 'getvar '(HPNAME CMDECHO))
 )
 (if (setq ss (ssget "_:L" '((0 . "SPLINE"))))
   (progn (mapcar 'setvar '(HPNAME CMDECHO) '("SOLID" 0))
          (setq l (entlast))
          (vla-startUndomark (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))))
          ((lambda (i / sn c o)
             (while (setq sn (ssname ss (setq i (1+ i))))
               (command "_.-hatch" "S" sn "" "")
               (if (not (eq l (setq o (entlast))))
                 (if (setq c (assoc 62 (entget sn)))
                   (entmod (append (entget o) (list (cons 62 (cdr c)))))
                   (entmod (append (entget o) '((62 . 256))))
                 )
               )
               (setq l o)
             )
           )
            -1
          )
          (vla-Endundomark doc)
   )
 )
 (*error* nil)
)(vl-load-com)

Edited by Tharwat
Link to comment
Share on other sites

Dear tharwat

i tried with this code it works, but fill with current layer color. I want it to recognise its boundry colour.

As boundry colours are different. It should fill with its boundry color.

I appriciate your help.

Barry

Link to comment
Share on other sites

Dear tharwat

i tried with this code it works, but fill with current layer color. I want it to recognise its boundry colour.

As boundry colours are different. It should fill with its boundry color.

I appriciate your help.

Barry

 

I am sorry , I did not try the codes before posting it , I modified it and you can try again .

Link to comment
Share on other sites

Dear Tharwat,

thank you very much. its works with plain circle, rectangle. but not with shaped outlines. pls explain me how to send a perticular dwg to you so that you can

persanally check whtas the problem with it. how can i post my sample dwg to you. let me know.

its works with any colour bou now with my closed shapes.

thanking you

Link to comment
Share on other sites

It works with circles , ellipses and closed polylines ONLY .

 

To upload a sample drawing , go Reply to Thread then at the bottom of the right side hand there is a button entitled Go Advanced then you should be able to attach .

Link to comment
Share on other sites

Dear Tharwat,

thank you very much. its works with plain circle, rectangle. but not with shaped outlines. pls explain me how to send a perticular dwg to you so that you can

persanally check whtas the problem with it. how can i post my sample dwg to you. let me know.

its works with any colour bou now with my closed shapes.

thanking you

Link to comment
Share on other sites

Dear Tharwat,

It work very efficiently. Many thanks once again.

It is saving my lots and lots of time. And it will boost my productivity much and much higher.

Link to comment
Share on other sites

Dear Tharwat,

It work very efficiently. Many thanks once again.

It is saving my lots and lots of time. And it will boost my productivity much and much higher.

 

You are welcome .

 

Wish you all the best with your work . :)

Link to comment
Share on other sites

Today while working on Acad2014 I was trying to save at lower version of auto cad. But it was giving me message that

You can only save in higher version. Even I tried to make 2004 dxf file from it. It is making dxf file of 2004 version. But when I tried to open it on acad 2006 or ever on acad 2012 auto cad it gives fatal error. While opening it. I can see preview in acad 2006 version. But problem is same. It gives message that it's size is too big. I tried to recover it but it won't allow me to save at lower version. I tried to insert same dwg in separate dwg. But not allowing me to to it. It is much much nessery to save at lower version.

Link to comment
Share on other sites

Today while working on Acad2014 I was trying to save at lower version of auto cad. But it was giving me message that

You can only save in higher version. Even I tried to make 2004 dxf file from it. It is making dxf file of 2004 version. But when I tried to open it on acad 2006 or ever on acad 2012 auto cad it gives fatal error. While opening it. I can see preview in acad 2006 version. But problem is same. It gives message that it's size is too big. I tried to recover it but it won't allow me to save at lower version. I tried to insert same dwg in separate dwg. But not allowing me to to it. It is much much nessery to save at lower version.

 

What all of that related to this thread Barry ?

Link to comment
Share on other sites

Open your drawing and purge it using the command line version pf the PURGE command which goes like this: -purge

 

YES! Include the dash in front of the word.

 

First purge Regapps. Repeat the command and do a Purge > All.

 

Run the OVERKILL command on your drawing to rid it of duplicate and overlapping lines.

 

Then run the AUDIT command and say "yes" to AutoCAD fixing any (database) errors it may find.

 

Repeat the entire process a second time.

 

Now save your drawing.

 

Close it.

 

Reopen it.

 

Now try to do a "saveas" 2004 DXF file format.

 

What happens?

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