this lisp was working fine but when i switch to autocad 2020 now it is asking for scale

this lisp was working fine but when i switch to autocad 2020 now it is asking for scale

nilesh.bhosale
Advocate Advocate
639 Views
8 Replies
Message 1 of 9

this lisp was working fine but when i switch to autocad 2020 now it is asking for scale

nilesh.bhosale
Advocate
Advocate

(defun c:iba ( / *error* adoc f file1 file_line scale dist_list e eo pt tang len rad_to_deg poz)
(defun *error* ( msg )
(if (not (member msg '("Function cancelled" "quit / exit abort")))
(princ (strcat "\nError: " msg))
)
(if adoc (vla-endundomark adoc))
(setvar 'cmdecho 1)
(setvar 'attdia 1)
(princ)
)
(defun rad_to_deg (rad)(* 180.0 (/ rad pi)))
(setvar 'cmdecho 0)
(setvar 'attdia 0)
(setq adoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq f (getfiled "Open Distance fileFile" (getvar "dwgprefix") "csv" 2))
(setq file1 (open f "r"))
(while (setq file_line (read-line file1))(setq dist_list (cons (atof file_line) dist_list)))
(close file1)
(setq dist_list (reverse dist_list ))
(setq scale (getreal "\nEnter block scale >"))
(vla-endundomark adoc)
(vla-startundomark adoc)
(setq e (car(entsel "\nSelect polyline >")))
(cond
((and e)
(setq eo (vlax-ename->vla-object e))
(setq len (vlax-get eo 'Length))
(setq poz 0.0)
(foreach dist dist_list
(setq poz (+ poz dist))
(setq pt (vlax-curve-getpointatdist eo poz))
(setq tang (angle '(0.0 0.0 0.0)(vlax-curve-getfirstderiv eo(vlax-curve-getparamatpoint eo pt))))
(command "_.-insert" "TR" "_none" pt scale (rad_to_deg tang))

)
)
)
(setvar 'attdia 1)
(setvar 'cmdecho 1)
(vla-endundomark adoc)
(princ)
)

0 Likes
Accepted solutions (2)
640 Views
8 Replies
Replies (8)
Message 2 of 9

hak_vz
Advisor
Advisor
Accepted solution

change line to

(command "_.-insert" "TR" "_none" pt scale scale (rad_to_deg tang))

If it doesn't work run command -INSERT and follow command prompts. Modify line accordingly.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 3 of 9

Kent1Cooper
Consultant
Consultant
Accepted solution

@nilesh.bhosale wrote:

....
(command "_.-insert" "TR" "_none" pt scale (rad_to_deg tang))

....


Message 2 is assuming the Block under the previous version is defined for uniform scaling, but not the one in the current version.  So it suggests repeating the 'scale' variable as answer to the Y scale factor prompt, which would not be there for a uniform-scale Block.  But I don't think that can be the answer, because in the line above, for a Block not defined for uniform scaling, it would use the 'scale' variable for the X scale, and then it would use the angle calculation for the Y scale factor, and it would leave you with the rotation prompt, not a scale factor prompt.

 

But just in case that's the issue somehow, is "TR" a Block defined within the drawing already, or an external drawing file?  If an external file, was it made by WBLOCKing a Block that was defined for uniform scaling from some drawing?

 

Is there any other message before the "asking for scale" that has scrolled up out of your visible command-line area?  [Press F2 for the text screen.]

Kent Cooper, AIA
0 Likes
Message 4 of 9

nilesh.bhosale
Advocate
Advocate

thank you very much Wblock is now working with this modified lisp

0 Likes
Message 5 of 9

nilesh.bhosale
Advocate
Advocate

excellent it is working now ....thanks a lot

0 Likes
Message 6 of 9

nilesh.bhosale
Advocate
Advocate

also i want to ask  you that ....

 

...by modifying above lisp...

can i insert attribute block instead of regular wblock or just a block???

 

0 Likes
Message 7 of 9

hak_vz
Advisor
Advisor

@nilesh.bhosale 

When you are selecting final solution, you should mark respondents code or reply and not your own reply.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 8 of 9

nilesh.bhosale
Advocate
Advocate

done thank you

0 Likes
Message 9 of 9

Kent1Cooper
Consultant
Consultant

@nilesh.bhosale wrote:

...by modifying above lisp...

can i insert attribute block instead of regular wblock or just a block???


Just add the correct number of non-constant Attribute values [as text strings] after the rotation angle entry in the (command "_.insert" ...) function.

Kent Cooper, AIA
0 Likes