danyra Posted February 26, 2020 Posted February 26, 2020 I want to make this design, as you can see in the image below. But, as you can see in the video I have some problems: First, I dont know why dont recognise the command "S"(Select object) in the command Hatch (watch it in the video), and then I have to make a enter, because without this wouldnt keep running(I dont understand also why). Second, I just codified that a single hatch circle would add the color 171. But, (as you can see in the video) all circles are painted in color 171, less the circle I seted it. (circle 1) Thanks if someone can help me. I am stucked. WhatsApp Video 2020-02-26 at 18.21.44.mp4 WhatsApp Video 2020-02-26 at 18.21.44.mp4 Quote ;CIRCLE 1 (the only circle I put a color in the hatch, but doesnt work) (setq R 0.0185);radio (setq P1ab (polar P1 (/ pi 2) (+ rec 0.02)));JUST A POINT TO HELP (setq P1a (polar p1ab pi (+(* rec2 2) R)));JUST A POINT TO HELP (entmakex (list '(0 . "CIRCLE") (cons 10 P1a) (cons 40 R) '(62 . 171))) (setq oldhat (getvar 'hpname)) (setvar 'hpname "Solid") (setq oldcol (getvar 'cecolor)) (setvar 'cecolor "171") (command "-hatch" "CO" 171 "" "s" (entlast) "" "");HERE I TRIED TO SET A COLOR TO THE HATCH, BUT AS YOU CAN SEE IN THE VIDEO: ALL CIRCLES ARE PAINTED LESS THIS (setvar 'hpname oldhat) (setvar 'cecolor oldcol) ;CIRCLE 2 (setq P2a (polar p1a pi 0.18));JUST A POINT TO HELP (entmakex (list '(0 . "CIRCLE") (cons 10 P2a) (cons 40 R) '(62 . 171))) (setq oldhat (getvar 'hpname)) (setvar 'hpname "Solid") (setq oldcol (getvar 'cecolor)) (setvar 'cecolor "171") (command "-hatch" "s" (entlast) "" "");HERE I DIDNT TRY TO SET A COLOR TO THE HATCH (setvar 'hpname oldhat) (setvar 'cecolor oldcol) ;CIRCLE 3 (setq P3a (polar p2a pi 0.18));JUST A POINT TO HELP (entmakex (list '(0 . "CIRCLE") (cons 10 P3a) (cons 40 R) '(62 . 171))) (setq oldhat (getvar 'hpname)) (setvar 'hpname "Solid") (setq oldcol (getvar 'cecolor)) (setvar 'cecolor "171") (command "-hatch" "s" (entlast) "" "");HERE I DIDNT TRY TO SET A COLOR TO THE HATCH (setvar 'hpname oldhat) (setvar 'cecolor oldcol) ;CIRCLE 4 (setq P4a (polar p3a pi 0.18));JUST A POINT TO HELP (entmakex (list '(0 . "CIRCLE") (cons 10 P4a) (cons 40 R) '(62 . 171))) (setq oldhat (getvar 'hpname)) (setvar 'hpname "Solid") (setq oldcol (getvar 'cecolor)) (setvar 'cecolor "171") (command "-hatch" "s" (entlast) "" "");HERE I DIDNT TRY TO SET A COLOR TO THE HATCH (setvar 'hpname oldhat) (setvar 'cecolor oldcol) Quote
BIGAL Posted February 27, 2020 Posted February 27, 2020 (edited) (entmakex (list '(0 . "DONUT") ………..Easier than hatching circle. Make inner rad real small 0.0001. Using command may be ok and fast enough very simple questions. Edited February 27, 2020 by BIGAL 1 Quote
dlanorh Posted February 27, 2020 Posted February 27, 2020 (edited) You could try this : (defun rh:circlehatch (pt r lyr c hs / c_obj h_obj bound) (setq spc (vlax-get-property (vla-get-activedocument (vlax-get-acad-object)) (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)) c_obj (vlax-invoke spc 'addcircle pt r) h_obj (vlax-invoke spc 'addhatch acHatchObject hs :vlax-true) bound (vlax-make-safearray vlax-vbObject '(0 . 0)) );end_setq (vlax-safearray-put-element bound 0 c_obj) (vla-appendouterloop h_obj bound) (vla-evaluate h_obj) (foreach x (list c_obj h_obj) (mapcar '(lambda (y z) (vlax-put x y z)) (list 'layer 'color) (list lyr c))) );end_defun It is a function and you call it like this (rh:circlehatch pt rad layer color hatch_pattern) ;pt is the centre of the circle )pt list) ;rad is circle radius (real) ;layer is the layer for the circle and hatch (string) ;color is the color for the circle and hatch (integer) ;hatch_pattern (string) ;example (rh:circlehatch (getpoint) pt 0.5 "0" 171 "Solid"); if bylayer color = 256 byblock color is 0 Edited February 29, 2020 by dlanorh Quote
ronjonp Posted February 27, 2020 Posted February 27, 2020 Why don't you use a block for this? 1 Quote
BIGAL Posted March 1, 2020 Posted March 1, 2020 Agree with ronjonp. Little mistake entmake a pline is actually a donut. 1 Quote
Recommended Posts
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.