aris63
08-03-2004, 08:12 PM
(sha-define-shop-table "ar-rect"
:TABLE-TITLE "Rectangular array"
:COLUMNS
(:HORIZ :VERT :SPACE_X :SPACE_Y :TOT_DIST_X :TOT_DIST_Y :TOOL_ID :DESCR :MIN_THICK :MAX_THICK :PREFERENCE :ADVICE)
:COLUMN-NAMES
("Horiz" "Vert" "Space x" "Space y" "Total Dist x" "Total Dist y" "Tool Id" "Descr" "Min Thick" "Max Thick" "Pref" "Advice")
:UNITS
(:mm :mm :mm :mm :mm :mm nil nil :mm :mm nil nil)
:CONTENTS
(
(10.00 3.00 3.00 3.00 121.00 32.00 "JLS" "array" 0.60 2.50 :PREF "-")
(12.00 3.00 4.00 3.00 115.00 32.00 "JLS" "array" 0.60 2.50 :PREF "-")
(15.00 3.00 5.00 3.00 148.00 21.00 "JLS" "array" 0.60 2.50 :PREF "-")
(15.00 3.00 4.00 4.00 160.00 40.00 "JLS" "array" 0.60 2.50 :PREF "-")
)
:KEY (:HORIZ :VERT :SPACE_X :SPACE_Y :TOT_DIST_X :TOT_DIST_Y )
:DISPLAY (:HORIZ :VERT :SPACE_X :SPACE_Y :TOT_DIST_X :TOT_DIST_Y :PREFERENCE :ADVICE)
:FLAT-TEXT (:TOOL_ID)
:MENU-ENTRY ("{1}x{2}" :HORIZ :VERT)
:HELP "sha_clstr_rect"
; unique, not displayable column entries
:PROF_FNC sha-rect-profile
)
(defun sha-rect-profile
(&key
horiz
vert
space_x
space_y
tot_dist_x
tot_dist_y
&allow-other-keys
)
(let* ((result nil)
(tool-wp (sha-tool-wp))
(dist_x (+ horiz space_x))
(dist_y (+ vert space_y))
(rows (truncate (/ tot_dist_x dist_x) ) )
(cloumn (truncate (/ tot_dist_y dist_y) ) )
(h (/ horiz 2))
(v (/ vert 2))
(ox (if (evenp rows)
(/ (* (- rows 1) dist_x) -2)
(/ (* (- (ceiling (/ rows 2) ) 1) dist_x) -1)
)
)
(oy (if (evenp column)
(/ (* (- column 1) dist_y) -2)
(/ (* (- (ceiling (/ column 2) ) 1) dist_y ) -1)
)
)
(x 0)
(y 0)
)
(create_workplane :new
:name tool-wp
:world_origin
)
;********* create Profile *******
(flet (
(create_rectangle (x y)
(POLYGON
(gpnt2d (- x h) (- y v))
(gpnt2d (- x h) (+ y v))
(gpnt2d (+ x h) (+ y v))
(gpnt2d (+ x h) (- y v))
(gpnt2d (- x h) (- y v))
)
)
)
(dotimes (i (ceiling column) )
(dotimes (j (ceiling rows) )
(create_rectangle (+ x ox) (+ y oy))
(setf x (+ x dist_x))
)
(progn
(setf x 0)
(setf y (+ y dist_y))
)
)
)
;******** create Adjustpoints ******
(C_POINT
0,0
)
(setq result (sha-profile-of-wp tool-wp))
(delete_3d (sha-absolute-name tool-wp))
result
)
)
But the ( dist_x dist_y rows cloumn ) parameter cann't get Variable
l
(setq dist_x (+ horiz space_x))
(dist_y (+ vert space_y))
(rows (truncate (/ tot_dist_x dist_x) ) )
(cloumn (truncate (/ tot_dist_y dist_y) ) )
I hope automate punch_tools
to make rectangle hole .
but lisp code is wrong
somebody can help me
:TABLE-TITLE "Rectangular array"
:COLUMNS
(:HORIZ :VERT :SPACE_X :SPACE_Y :TOT_DIST_X :TOT_DIST_Y :TOOL_ID :DESCR :MIN_THICK :MAX_THICK :PREFERENCE :ADVICE)
:COLUMN-NAMES
("Horiz" "Vert" "Space x" "Space y" "Total Dist x" "Total Dist y" "Tool Id" "Descr" "Min Thick" "Max Thick" "Pref" "Advice")
:UNITS
(:mm :mm :mm :mm :mm :mm nil nil :mm :mm nil nil)
:CONTENTS
(
(10.00 3.00 3.00 3.00 121.00 32.00 "JLS" "array" 0.60 2.50 :PREF "-")
(12.00 3.00 4.00 3.00 115.00 32.00 "JLS" "array" 0.60 2.50 :PREF "-")
(15.00 3.00 5.00 3.00 148.00 21.00 "JLS" "array" 0.60 2.50 :PREF "-")
(15.00 3.00 4.00 4.00 160.00 40.00 "JLS" "array" 0.60 2.50 :PREF "-")
)
:KEY (:HORIZ :VERT :SPACE_X :SPACE_Y :TOT_DIST_X :TOT_DIST_Y )
:DISPLAY (:HORIZ :VERT :SPACE_X :SPACE_Y :TOT_DIST_X :TOT_DIST_Y :PREFERENCE :ADVICE)
:FLAT-TEXT (:TOOL_ID)
:MENU-ENTRY ("{1}x{2}" :HORIZ :VERT)
:HELP "sha_clstr_rect"
; unique, not displayable column entries
:PROF_FNC sha-rect-profile
)
(defun sha-rect-profile
(&key
horiz
vert
space_x
space_y
tot_dist_x
tot_dist_y
&allow-other-keys
)
(let* ((result nil)
(tool-wp (sha-tool-wp))
(dist_x (+ horiz space_x))
(dist_y (+ vert space_y))
(rows (truncate (/ tot_dist_x dist_x) ) )
(cloumn (truncate (/ tot_dist_y dist_y) ) )
(h (/ horiz 2))
(v (/ vert 2))
(ox (if (evenp rows)
(/ (* (- rows 1) dist_x) -2)
(/ (* (- (ceiling (/ rows 2) ) 1) dist_x) -1)
)
)
(oy (if (evenp column)
(/ (* (- column 1) dist_y) -2)
(/ (* (- (ceiling (/ column 2) ) 1) dist_y ) -1)
)
)
(x 0)
(y 0)
)
(create_workplane :new
:name tool-wp
:world_origin
)
;********* create Profile *******
(flet (
(create_rectangle (x y)
(POLYGON
(gpnt2d (- x h) (- y v))
(gpnt2d (- x h) (+ y v))
(gpnt2d (+ x h) (+ y v))
(gpnt2d (+ x h) (- y v))
(gpnt2d (- x h) (- y v))
)
)
)
(dotimes (i (ceiling column) )
(dotimes (j (ceiling rows) )
(create_rectangle (+ x ox) (+ y oy))
(setf x (+ x dist_x))
)
(progn
(setf x 0)
(setf y (+ y dist_y))
)
)
)
;******** create Adjustpoints ******
(C_POINT
0,0
)
(setq result (sha-profile-of-wp tool-wp))
(delete_3d (sha-absolute-name tool-wp))
result
)
)
But the ( dist_x dist_y rows cloumn ) parameter cann't get Variable
l
(setq dist_x (+ horiz space_x))
(dist_y (+ vert space_y))
(rows (truncate (/ tot_dist_x dist_x) ) )
(cloumn (truncate (/ tot_dist_y dist_y) ) )
I hope automate punch_tools
to make rectangle hole .
but lisp code is wrong
somebody can help me