Message 1 of 30
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear Sir,
I want calculation auto lisp program. out put text are attributes block.
Please find the attachment.
Solved! Go to Solution.
Dear Sir,
I want calculation auto lisp program. out put text are attributes block.
Please find the attachment.
Solved! Go to Solution.
In simplest terms, using whatever the current Text Style and height are, on the current Layer, and assuming the current Style does not have a fixed height, and with all issues of relative positioning, etc. to be dealt with if you don't want them just stacked up, here's one way to do it:
(defun C:DOIT () (setq Base (getdist "\nBase: ") Altitude (getdist "\nAltitude: ") 1stSlope (sqrt (+ (expt Altitude 2) (expt Base 2))) 2ndSlope (sqrt (+ (expt 1stSlope 2) (expt Base 2))) TSlopeTanB (/ Base Altitude) 2TanB (* TSlopeTanB 2) Face (/ 1stSlope Altitude) Dev (/ 2ndSlope Altitude) FSlopeTanB (/ Base 1stSlope) SecB (/ Dev Face) ) (command "_.text" (getvar 'viewctr) "" "" (strcat "1st Slope = " (rtos 1stSlope 2 4))) (command "_.text" "" (strcat "2nd Slope = " (rtos 2ndSlope 2 4))) (command "_.text" "" (strcat "TanB = " (rtos TSlopeTanB 2 9))) (command "_.text" "" (strcat "2TanB = " (rtos 2TanB 2 9))) (command "_.text" "" (strcat "Face = " (rtos Face 2 9))) (command "_.text" "" (strcat "Dev = " (rtos Dev 2 9))) (command "_.text" "" (strcat "TanB = " (rtos FSlopeTanB 2 9))) (command "_.text" "" (strcat "SecB = " (rtos SecB 2 9))) )
You can specify the Base and Altitude by either typing in values or picking points on-screen.
I notice that you're still calling for two with the same heading....
Thank You very much sir
calculation result is ok,but one change
Please adding red mark text this position.
1st Slope
2nd Slope
TOWER SLOPE
TanB
2TanB
Face
Dev
IN FACE SLOPE
TanB
SecB
(defun C:DOIT () (setq Base (getdist "\nBase: ") Altitude (getdist "\nAltitude: ") 1stSlope (sqrt (+ (expt Altitude 2) (expt Base 2))) 2ndSlope (sqrt (+ (expt 1stSlope 2) (expt Base 2))) TSlopeTanB (/ Base Altitude) 2TanB (* TSlopeTanB 2) Face (/ 1stSlope Altitude) Dev (/ 2ndSlope Altitude) FSlopeTanB (/ Base 1stSlope) SecB (/ Dev Face) ) (command "_.text" (getvar 'viewctr) "" "" (strcat "1st Slope = " (rtos 1stSlope 2 4))) (command "_.text" "" (strcat "2nd Slope = " (rtos 2ndSlope 2 4))) (command "_.text" "" " " "_.text" "" "Tower Slope" "_.chprop" "_last" "" "_color" 1 "") (command "_.text" "" (strcat "TanB = " (rtos TSlopeTanB 2 9)) "_.chprop" "_last" "" "_color" "_bylayer" "") (command "_.text" "" (strcat "2TanB = " (rtos 2TanB 2 9))) (command "_.text" "" (strcat "Face = " (rtos Face 2 9))) (command "_.text" "" (strcat "Dev = " (rtos Dev 2 9))) (command "_.text" "" " " "_.text" "" "In Face Slope" "_.chprop" "_last" "" "_color" 1 "") (command "_.text" "" (strcat "TanB = " (rtos FSlopeTanB 2 9)) "_.chprop" "_last" "" "_color" "_bylayer" "") (command "_.text" "" (strcat "SecB = " (rtos SecB 2 9))) )
Thank You Very Much sir
I am about to do some lisp coding of something almost similar but it is another calculations and I need to put the results inside an attribute inside a block.
And:
1. How do put the calculation results inside a block with attributes?
2. How do hit the right attribute with the right named tag?
Can you or somebody hint me in any direction or maybe some code examples.
Try:
(setpropertyvalue BlockEntityName "AttributeTag" "theValue")
This is a method without using setproperty, the tag name is oldtagn and the string to be entered is newstr, this code is part of looping through all layouts. Not all Cad programs support setproperty.
(if (setq ss1 (ssget "x" (list (cons 0 "INSERT") (cons 2 bname)(cons 410 tabname))))
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes)
(if (= oldtagn (strcase (vla-get-tagstring att)))
(vla-put-textstring att newstr)
)
)
@Sea-Haven wrote:
.... Not all Cad programs support setproperty.
[But AutoCAD does. This is, it should be noted, an AutoCAD Forum specifically, not an "all Cad programs" Forum.]
Are there no Forums for those programs, where people would not be inconvenienced by finding they can't use some of the solutions?