Brian Ekins

February 2012

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29      

« Working with Filenames | Main | Autodesk University Class Proposals (Last Call) »

May 06, 2010

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e553fcbfc688340134808d194b970c

Listed below are links to weblogs that reference Using VBA Sample Code (for the Non-Programmer):

Comments

Lionel

Hi, I'm new in development of macro for inventor but the code used in your screen seem to be very interesting for me (Flattern assembly) It's exactly what I wanna do to be more iefficient :)
Is it possible to get it ? I'm also looking for a code to save all flat patterns of sheemetal parts in a assembly which contains standard parts and sheetmetal parts, any suggestion to modify the code ? MAny thanks for your help.

Eloisio Henrique

I have used the code bellow ( Autolisp code ) into AutoCad 2004 to make baloons.
Now we migrated for Autodesk Inventor 2011 but we get the following error:

** Esse comando não pode ser chamado de modo transparente **
; erro: Função cancelada


Does anybody know if the new version of the Autocad ( Inventor 2011 ) doesn´t work correctly with Autolisp routines? Or could somebody give qa help to solve this error?


Variaveis:
blndia balao diameter, GLOBAL
blnnum balao number, GLOBAL
cen Center of balao
ep Endpoint of arrow
oom Old osnap mode
sp Start point of arrow
temp Temp. value for blndia and blnnum input
ts Name of current text style
tshei Text style height |;

;10====PROGRAM SETUP

(defun c:balao (/ cen ep oom sp temp ts tshei)
(setq oom (getvar "osmode"))
(graphscr)

;20====GET SIZE, START POINT, CENTER, & NUMBER

(if (null blndia)
(if (= 0 (getvar "dimscale"))
(setq blndia (/ (getvar "dimtxt") 0.28))
(setq blndia (/ (* (getvar "dimtxt") (getvar "dimscale")) 0.28))
)
)
(initget 6)
(setq temp (getreal (strcat "\nDiametro do Balão : ")))
(if temp (setq blndia temp))

(setvar "osmode" 512)
(initget 1)
(setq sp (getpoint "\nIndique a cota: "))
(setvar "osmode" 0)

(initget 1)
(setq cen (getpoint sp "\nLocal do balao: "))

(if (null blnnum) (setq blnnum 0))
(setq blnnum (1+ blnnum))
(initget 6)
(setq temp (getint (strcat "\nNúmero do Balão : ")))
(if temp (setq blnnum temp))

;30====CALCULATE END POINT OF ARROW, GET TEXT STYLE HEIGHT, DRAW balao

(setq ep (polar cen (angle cen sp) (/ blndia 2)))

(setq ts (getvar "textstyle"))
(setq tshei (cdr (assoc 40 (tblsearch "style" ts))))
(if (> tshei 0) (princ "\nEstilo do texto tem altura fixa; pode não caber no balão."))

(setvar "cmdecho" 0)

(command ".dim" "LEADER" sp ep) (command)

(command ".circle" cen "D" blndia)

(if (> tshei 0)
(command "_.text" "M" cen 0 blnnum)
(command ".text" "M" cen (* 0.28 blndia) 0 blnnum)
)

;40====RESET

(setvar "cmdecho" 1)
(setvar "osmode" oom)
(princ)
)

Romil

Thanks.
It's really good..

marcos

Iam a old mechanical engineer who need to learn more about VBA this is good start for me keep doing it
Thanks
Marcos Diaz
Dominican Republic

The comments to this entry are closed.

RSS Feed

  •  Subscribe

Survey