Also, if the "MTEXT" is, you can select all desired "MTEXT" and from "PROPERTIES" tab, select "Text frame". That is the easiest way to do and make a boundary around text. If the "TEXT" is, you can use a built-in function in CAD "TXT2MTXT", select all "TEXT" entities and convert it in "MTEXT" and than add a frame.
A possible easy fix try this (setvar 'dimzin 2) at start of code.
: (setq num 20)
20
: (rtos num 2 2)
"20.00"
: (setq num 12.5)
12.5
: (rtos num 2 2)
"12.50"
: (setq num 12.345)
12.345
: (rtos num 2 2)
"12.35"
Some extra hints
;; Set the text height for the Title, Header and Data rows
(vla-SetTextHeight custObj acDataRow txtht)
(vla-SetTextHeight custObj acHeaderRow (* txtht 1.2))
(vla-SetTextHeight custObj acTitleRow (* txtht 1.5))
; Set the alignment for the Data, Header, and Title rows
(vla-SetAlignment custObj (+ acDataRow acHeaderRow acTitleRow) acMiddleCenter)
(vla-SetTextStyle custObj (+ acDataRow acHeaderRow acTitleRow) "Arial")
There is some other parentheses misplaced in the 'circle->polygon' function.
(defun circle->polygon (cen rad / i N ang x y ptlst)
(setq N 36
i 0
ptlst '()
)
(while (< i N)
(setq ang (* 2.0 pi (/ i (float N)))
x
(+ (car cen) (* rad (cos ang)))
y
(+ (cadr cen) (* rad (sin ang)))
)
(setq ptlst (append ptlst (list (list x y))))
(setq i (1+ i))
)
(setq ptlst (append ptlst (list (car ptlst))))
ptlst
)
@leonucadomi
Copy the code again. Something has changed. Check if it works.
The accuracy should be adjustable with some system variable.
When I get home I'll take a look
You appear to have a list of all the values so do one row at a time column C would be for a row (- ( Nth (1+ x) lst) (nth x lst)). Note need to do for one less than the length of list as the last entry will error as there is no dummy value past the last item in the list. Then do last row.
I tend to use Insertrows in a table much easier as you just read each line of the list and add a row.
Can read excel direct if you want.
(vla-insertrows objtable numrows (vla-GetRowHeight objtable (1- numrows)) 1)
In any case: if you use the 'boundary' command and there is no defined boundary around it, it is possible that 'boundary' will take forever and you will get the feeling that it is the code that is failing.
But no: your code is FINE
Hi
I assume the numbers you are talking about are 'TEXT' objects.
If this is the case, you need to add a filter to 'ssget'
Replace '((8 . "Lot Layer")) ' with '((0 . " TEXT") (8 . "Lot Layer")) '
Thanks rlx this one sort of works for me. It only works if you have minimised the window.
(vla-put-windowstate excelApp acMax)
Also running dual screens.
Need a Powershell script. ie winodws OS level.
Ok found something now have to remember how to incorporate into a Powershell script and run from CAD, have done it before.
$wshell = New-Object -ComObject wscript.shell
$wshell.AppActivate('Excel')
If you want to try, go bottom right in windows type cmd then powershell paste the 2 lines. Have an Excel open.