Where do I go wrong ?
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Where do I go wrong ?

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
Dr Fleau
Guest





Posted: Fri Nov 04, 2005 5:10 pm    Post subject: Where do I go wrong ? Reply with quote

I wrote a little something to create flanges with just a few questions. The
code is simple enough, but the holes on the bolt circle are always arrayed
from a center point which is a hole radius away from the diameter center.
Confused ? Good. Here's the code, try it out. It's french, but most of you
shouldn't have a problem with that.


And yes, Bride means flange.

Thanx

Dr Fleau


;;; Bride.lsp
;;; Dessine une bride avec quelques questions
;;; Trace les centres des cercles avant de faire un array
(DEFUN c:bride (/ out in bc num trou cen cen1 cir1 cir2 cir3)
(SETQ out (GETREAL "Donne le diamètre EXTÉRIEUR : ")
in (GETREAL "Donne le diamètre INTÉRIEUR :")
bc (GETREAL "Donne le diamètre de perçage : ")
num (GETINT "Combien de trous : ")
trou (GETREAL "Quel diamètre de trou : ")
cen (GETPOINT "Point d'insertion : ")
) ;_ end of setq
(IF (NOT (AND (TBLSEARCH "layer" "Axe")
(TBLSEARCH "layer" "Pièce")
) ;_ END and
) ;_ END not
(PROGN
(COMMAND "layer" "m" "Axe" "c" "Red" "" "l" "center" "" "") ;_ END
COMMAND
(COMMAND "layer" "m" "Pièce" "c" "Magenta" "" "l" "continuous" "" "")
;_ END COMMAND
) ;_ END progn
)
(SETVAR "OSMODE" 0)
(setvar "CLAYER" "Pièce")
(COMMAND "_.circle" cen "D" out)
(COMMAND "_.circle" cen "D" in)
(SETQ cen1 (POLAR cen (/ PI 2) (/ bc 2)))
(COMMAND "_.circle" cen1 "D" trou)
(setq cir1 (entlast))
(setvar "CLAYER" "AXE")
(command "_.line" (polar cen1 (/ pi 2) (/ trou 2)) (polar cen1 (/ pi -2)
(/ trou 2)) "")
(setq cir2 (entlast))
(command "_.line" (polar cen1 pi (/ trou 2)) (polar cen1 0.0 (/ trou 2))
"")
(setq cir3 (entlast))
(setvar "OSMODE" 0)
(command "_.regen")
(COMMAND "_.array" cir1 cir2 cir3 "" "P" cen num 360 "N")
(setvar "CLAYER" "Pièce")
(SETVAR "OSMODE" 183)
(PRINC)
) ;_ end of defun

Back to top
CarlB



Joined: 27 Sep 2005
Posts: 52

Posted: Fri Nov 04, 2005 7:07 pm    Post subject: re:Where do I go wrong ? Reply with quote

The problem is with how the "array" command works.

Hint: if the objects ARE rotated during an array, the array will be concentric with other circles.
Back to top
View user's profile Send private message
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB