Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Circle to hexagon? 3

Status
Not open for further replies.

srcurrie

Electrical
Mar 28, 2001
1
I have a riser diagram with circles shown as smoke detectors, the genious engineer has come back and said he wants hexagons instead. Without actually drawing a polygon over the circle I would like to see if there is a way to just convert to hexagon. I am prbably crazy but it worth a shot.
 
Replies continue below

Recommended for you

If you have the symbol as a block you could just change your block to a hex and update. Otherwise your going to have to draw a hex polygon at least once and copy to the other locations. Steve Smith
Product Engineer
Staco Energy Products Co.
 
If it's not a block, I could write a quick program to convert all of the circles to hexagons. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
; SQUARING ALL CIRCLES -OR HEXAGONING
; Please post debugging results - this is written today!!
;COMMAND: Circulation - converts all selected circles into polygones
;File: Circulation.lsp
;Written by Dr. Tigrek
;
;Get circles by any method you like - follow prompts to get objects
;only circles will be taken seriously, others will be ignored
(defun C:Circulation()
;get the few parameters

(initget (+ 1 2 4))
(while (<
(setq HowManySides (getint &quot;\nHow Many Sides to each Polygon ?&quot;))
3)
)

(initget 1 &quot;Inside Outside&quot;)
(setq InsideOutside (getkword &quot;\nPolygon Inside or Outside the circle (I/O): &quot;))
(if (= InsideOutside &quot;Inside&quot;) (setq InsideOutside &quot;_I&quot;)(setq InsideOutside &quot;_C&quot;))
;big IF
(IF
;this allows select objects by any way you like
(setq sset (ssget (list (cons 0 &quot;CIRCLE&quot;))))
;PROGN IS NEEDED BECAUSE MORE THAN ONE STATEMENTS FOLLOW IF TRUE
(PROGN
;this tells how many circles were caught, picked, windowed, crossed
(setq ssetl (sslength sset))
;just for information, to see the circle count on command line
(print ssetl)(princ &quot; Circles found...&quot;)


(setq i 0)

(while (< i ssetl)
(setq Edna (ssname sset i))
(setq Eddy (entget Edna))

(setq Typy (dxf 0 Eddy)
; this is not really used. Was for debugging
Insy (dxf 10 Eddy)
; Insertion point of circle we are going to erase
Rady (dxf 40 Eddy)
;radius of circle we are going to erase
)
;this is tricky (x Y) = (10 20) will be converted into &quot;10,20&quot;
(setq Insy (strcat
(rtos (car Insy) 2)
&quot;,&quot;
(rtos (cadr Insy))
)
)

;and this converts R= 25.5 into &quot;25.5&quot;
(setq rady (rtos rady 2))

;this was for debugging. Don't need anymore
;(print Insy)(print Rady)

;erase the circle
(COMMAND &quot;_erase&quot; Edna &quot;&quot;)
;insert block circle with scale factor
;to correspond to radius of erased circle

(COMMAND &quot;_polygon&quot; HowManySides Insy InsideOutside rady)


(setq i (+ 1 i));NEXT CIRCLE
);while ends here
)(print &quot;No Circles Found!&quot; ));big IF ends here
(princ);suppress repeated prompt
);end of main function

;Useful function to extract-
;Entity name &quot;CIRCLE n= 0
;Insy InsertionPoint n= 10
;rady radious n= 40
;ed is full entity data
(defun dxf (n ed) (cdr (assoc n ed)))

;FOR ALL VERSIONS OF AUTOCAD
;SAVE AS Circulation.lsp to directory \SUPPORT;and from command line: (load &quot;Circulation&quot;)
;then, on command line, type Circulation AND FOLLOW SELLECT-OBJECT PROMPTS
;ERASES ALL PICKED CIRCLES AND REPLACES EACH WITH A POLYGON
;FITTING INSIDE/OUTSIDE OF EACH ERASED CIRCLE
;AND INSERTED AT ITS CENTER POINT,
;NOW CIRCLES ARE POLYGONS
;RICHLY COMMENTED FOR YOUR CONVENIENCE AND MODIFICATIONS
;FOR QUESTIONS please call at:
;;I am home most of the time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor