• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

insert multipled perimeter command for a default value

  • Thread starter Thread starter Yebisu
  • Start date Start date

Yebisu

Guest
Good morning,
I already have top where it gives me with a vba command the perimeter and inserts it into the drawing,
I would like to add perimeter * value (0.16 and 0.9).
I don't really know where to go.

Thank you.
 
but who is this top? a good one, or a program that stands up?
you are in the vba section, you would like a help to change a command, supposedly written in vba, but do not attach it, there is no code, do not specify the perimeter of what, lines, polylines, you look for etc.
reformulate the question and explain yourself better.
bye
 
Sorry I was very vague, it's the hot air condition broken :d
..top is an external program... obviously I tried to search for the vbas of the command, but they are well hidden... or I don't know where to look for them... I found the name of the vba, looking at the button, I tried to do a search in the autocad folder but nothing...

the command calculates the perimeter of the whole figure includes lines circles etc. I need to multiply that value for a calculation of the working time of a mill according to the milled material.


Thank you.
 
Code:
(defunc c:perimeter (/ pt1 perim)
(setq pt1 (getpoint "select internal point: ")
(setq perim)
(if (/= perim nil)
(command "_text" "_j" "_m" pt1 "" 0 (strcat "p=" (rtos perim 2))
)
)

(defunc c:perimetro016 (/ pt1 perim)
(setq pt1 (getpoint "select internal point: ")
(setq perim)
(if (/= perim nil)
(command "_text" "_j" "_m" pt1 "" 0 (strcat "p*0.16=" (rtos (* perim 0.16) 2))
)
)

(defunc c:perimetro09 (/ pt1 perim)
(setq pt1 (getpoint "select internal point: ")
(setq perim)
(if (/= perim nil)
(command "_text" "_j" "_m" pt1 "" 0 (strcat "p*0.9=" (rtos (* perim 0.9) 2))
)
)

(defun fnperimeter (pt1 / n1 n2 pt1)
(setq n1 (entlast)
(command "_bpoly" "_a" "_o" "_r" "" pt1 "")
(setq n2 (entlast)
(if (not (equal n2))
(progn)
(command "_area" "_o" "_last")
(command "_erase" n ")
(getvar "perimeter")
)
(alert "problem with internal figure calculation")
)
)
is in lisp, in the simplest form possible, then create a file and paste the code.
after uploading it you have 3 commands, perimeter, which adds a text with its calculated value using the bpoly command, perimeter09, equal but multiplies by 0.9 and perimeter016, same logic.
the text has height as from variable textsize, angle 0, the value is formatted in decimal format, number of decimals as from command units.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top