jimpcfd Posted August 3, 2010 Share Posted August 3, 2010 (edited) Hi All i have a lisp file which is a parametric drawing of a folder(envelope) which i wish to convert to VBA, my first question is can it be done and can someone give some tips on the best way to do it etc etc . lisp code listed below ... [(princ "\nType FOLDER to start") (defun c:env () (setvar "cmdecho" 0) (setq UserOS (getvar "osmode")) (setvar "osmode" 0) ;;======get envelope data============= (initget 1) (setq Width (getreal "\nWidth: ")) (initget 1) (setq Length (getreal "\nLength: ")) (initget 1) (setq PocketD (getreal "\nPocket Depth: ")) (initget 1) (setq PocketCB (getreal "\nPocket Cut Back: ")) (initget 1) (setq GlueFL (getreal "\nGlue Flap Length: ")) (initget 1) (setq GlueFW (getreal "\nGlue Flap Width: ")) (initget 1) (setq GlueFCB (getreal "\nGlue Flap Cut Back: ")) ;;=======calculate line endpoints============= (setq hpi (/ pi 2)) (setq FlapJog (/ (- PocketD GlueFW GlueFCB) 2)) (setq Pt1 '(0.0 0.0);;LL corner of envelope Pt2 (polar Pt1 hpi Length) Pt3 (polar Pt2 0 Width) Pt4 (polar Pt3 0 Width) Pt5 (polar Pt4 (- hpi) Length) Pt6 (polar Pt5 (- hpi) GlueFCB) Pt7 (mapcar '+ Pt6 (list GlueFL (- Flapjog))) Pt8 (polar Pt7 (- hpi) GlueFW) Pt9 (polar Pt5 (- hpi) PocketD) Pt10 (polar Pt9 pi (- Width PocketCB)) Pt11 (polar Pt10 hpi PocketD) Pt12 (polar Pt1 0 Width) );setq (command "._layer" "_M" "CUT" "" "._color" "RED") (command "._line" Pt1 Pt2 Pt3 Pt4 Pt6 Pt7 Pt8 Pt9 Pt10 Pt11 Pt1 "") (command "._layer" "_M" "CREASE" "" "._color" "GREEN") (command "._line" Pt3 Pt12 "" "._line" Pt11 Pt5 "" "._line" Pt6 Pt9 "") ;(command "._layer" "_S" "0" "" "._-color" "_bylayer") (setvar "osmode" UserOS) (princ) );defun thanks Edited August 10, 2010 by Tiger added code-tags Quote Link to comment Share on other sites More sharing options...
leigh_elkins Posted August 6, 2010 Share Posted August 6, 2010 This can be done in VBA. There isn't a straight forward conversion routine though, but I will see if I can dig out a bit of VBA I did a few years back which does a similar thing which will give you some pointers. Quote Link to comment Share on other sites More sharing options...
jimpcfd Posted August 10, 2010 Author Share Posted August 10, 2010 that would be great as i never done anything in VBA before. cheers Quote Link to comment Share on other sites More sharing options...
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.