Jump to content

Convert lisp file to vba


jimpcfd

Recommended Posts

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 by Tiger
added code-tags
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...