CoCreate User Forum  

Go Back   CoCreate User Forum > Applications > Modules
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 08-03-2004, 08:12 PM
aris63 aris63 is offline
Registered User
 
Join Date: Jan 2003
Posts: 16
about sheet metal punch_function

Code:
(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
)

Code:
(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
Code:
 
(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
Attached Thumbnails
Click image for larger version

Name:	clipboard.jpg
Views:	415
Size:	50.2 KB
ID:	330  
__________________
(Sorry ! My English is pool)

Last edited by aris63; 08-08-2004 at 06:40 PM.
Reply With Quote
  #2  
Old 08-09-2004, 06:06 PM
aris63 aris63 is offline
Registered User
 
Join Date: Jan 2003
Posts: 16
Re: about sheet metal punch_function

Quote:
(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) ) )
truncate converts its argument by truncating toward zero; that is, the result is the integer of the same sign as the argument and which has the greatest integral magnitude not greater than that of the argument

but it must like this (x (truncate 5 2) ) or (x ( truncate (/ y 2)) )

The rows and column transform integer

if rows =3.2 --> 3.0
rows=3.6 --> 3.0

column=8.3 --> 8.0
column=8.6 --> 8.0

How to do it

__________________
(Sorry ! My English is pool)

Last edited by aris63; 08-09-2004 at 09:44 PM.
Reply With Quote
  #3  
Old 08-30-2004, 01:06 AM
aris63 aris63 is offline
Registered User
 
Join Date: Jan 2003
Posts: 16
Re: about sheet metal punch_function

Code:
 
          (rows (truncate  (/ tot_dist_x dist_x) ) )
          (cloumn (truncate  (/ tot_dist_y dist_y) ) )
The answer is

Code:
 
          (rows (truncate  (/  (*  (/ tot_dist_x dist_x)  2)  2) ) )
          (cloumn (truncate (/  (* (/ tot_dist_y dist_y)  2)  2) ) )
I solve this problem
__________________
(Sorry ! My English is pool)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:46 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.