Jump to content
DYNAMO J.

Draw panels using vba or excel

Recommended Posts

DYNAMO J.

I want to draft panels using VBA or EXCEL data, anyone give the script for the same,

 i have attached drafting flow here, please see attached cad file.

A Panel.dwg

Share this post


Link to post
Share on other sites
BIGAL

This would be the method  etc its all been done before mainly in lisp. 

 

Get get say lower left point. Length &  width draw a pline 4 sides

Draw 4 plines that are the green offsets you know the co-ords of the 4 corner points.

Take the Length /400 get x.xx you take the fix and work out the odd end measurements

Draw the circles top bottom

Work out the width = /400 etc

Draw the circles.

 

(defun c:panel ( / len wid pt1 pt2 pt3 pt4)
(setq pt1 (getpoint "\nPick lower left Corner"))
(setq Len (Getreal "\nEnter length"))
(setq wid (Getreal "\nWidth"))
(setq pt2 (polar Pt1 0.0 len))
(setq pt3 (polar pt2 (/ pi 2.0) wid))
(setq pt4 (polar pt3 pi len))
(command "pline" pt1 pt2 pt3 pt4 "c")
)
(C:panel)

Ok so for green lines do a change layer (setvar 'clayer "greenlines")

you work out 3 new pts using polar command again (setq pt5 (polar pt1 (* 1.5 pi) off))

work out pt6 

then (command "pline" pt1 pt5 pt6 pt2 "")

redo for 3 other sides

 

(setq num (fix (- (/ len 400.0) 1)))
(setq off2 ( / (- len (* num 400.0)) 2.0))

Now work out some more points for the circles 

do again for 3 other sides

Share this post


Link to post
Share on other sites
DYNAMO J.
On 10/20/2019 at 8:32 AM, BIGAL said:

This would be the method  etc its all been done before mainly in lisp. 

 

Get get say lower left point. Length &  width draw a pline 4 sides

Draw 4 plines that are the green offsets you know the co-ords of the 4 corner points.

Take the Length /400 get x.xx you take the fix and work out the odd end measurements

Draw the circles top bottom

Work out the width = /400 etc

Draw the circles.

 


(defun c:panel ( / len wid pt1 pt2 pt3 pt4)
(setq pt1 (getpoint "\nPick lower left Corner"))
(setq Len (Getreal "\nEnter length"))
(setq wid (Getreal "\nWidth"))
(setq pt2 (polar Pt1 0.0 len))
(setq pt3 (polar pt2 (/ pi 2.0) wid))
(setq pt4 (polar pt3 pi len))
(command "pline" pt1 pt2 pt3 pt4 "c")
)
(C:panel)

Ok so for green lines do a change layer (setvar 'clayer "greenlines")

you work out 3 new pts using polar command again (setq pt5 (polar pt1 (* 1.5 pi) off))

work out pt6 

then (command "pline" pt1 pt5 pt6 pt2 "")

redo for 3 other sides

 


(setq num (fix (- (/ len 400.0) 1)))
(setq off2 ( / (- len (* num 400.0)) 2.0))

Now work out some more points for the circles 

do again for 3 other sides

this is only rectangle script, please could you provide me script for whole object

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...