سبع الليل Posted February 22, 2013 Share Posted February 22, 2013 (edited) بسم الله الرحمن الرحيم الحمد لله وحده و الصلاة و السلام على من لا نبي بعده ،، و بعد In the Name of Allah, the Most Beneficent, the Most Merciful Dear kind members : I have a question : i wrote this routine ,,, what i want is attaching steel bar info with the polyline entity ,, so when i call it i can get like any other property here is the code (defun c:bara () (setq n (getint "\nEnter number of bars")) (setq d (getint "\nEnter diameter of bars")) (regapp "barinfo") (setq oldlist (entget (car (entsel)))) (setq barinfo '((-3 ("barinfo" (1005 . n) (1070 . d)))) (setq newlist (append oldlist barinfo)) (entmod newlist) ) but this give me a bad dxf function because the code i enserted is wrong what,s the right code which can i use it for this routine ,, or how can i fix it ?? i hope you can understand me ,, and sorry for my weak English Edited February 22, 2013 by سبع الليل Quote Link to comment Share on other sites More sharing options...
fixo Posted February 22, 2013 Share Posted February 22, 2013 Try this code snip, change items to your suit ;build extension data (setq xdata (list (list -3 (list "barinfo" (cons 1040 ps);real (cons 1041 ln);distance (cons 1000 hws);string (cons 1000 hwr);string ;etc etc... )) ) ) (setq xdlist (append elist xdata));append extension data to entity list (entmod xdlist); setting data, modify entity list (entupd en); update entity, optonal Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 22, 2013 Share Posted February 22, 2013 By constructing the list with quote instead of LIST function you were preventing the evaluation of the n and d variables. Also for integers must use the DXF code 1070. There was also an unbalansed paranthesis. (defun c:bara () (setq n (getint "\nEnter number of bars")) (setq d (getint "\nEnter diameter of bars")) (regapp "barinfo") (setq oldlist (entget (car (entsel)))) (setq barinfo [color=red](list (list[/color] -3 [color=red](list[/color] "barinfo" [color=red](cons 1070[/color] n) [color=red](cons[/color] 1070 d))))[color=red])[/color] (setq newlist (append oldlist barinfo)) (entmod newlist) ) Also, welcome to the Forum! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 22, 2013 Share Posted February 22, 2013 Welcome to CADTutor. The apostrophe will mark an expression as a literal (to be taken at face-value and not evaluated), hence the symbols 'n' & 'd' within your xData list will not be evaluated. For more information on the apostrophe, see my post here. Furthermore, you are using DXF group 1005 (handle) to store an integer value, this group should be either group 1070 or group 1071 depending upon the size of your integer value. However, since you are prompting for a diameter, I would think the value should be a real (double) and using group 1040, or group 1041 (distance) rather than an integer. Quote Link to comment Share on other sites More sharing options...
سبع الليل Posted February 22, 2013 Author Share Posted February 22, 2013 Mr Fixo Mr Msasu Mr Lee Mac Really I thank you all very much ,,, and i will not forget your favour ,,, I understand now what is problem ,, and i fixed it ,, it will help me tooo much ,, what i was made in 5 hours now i can make in 5 minuites ... I hope my english was strong enough to can express my thanks to you U R really Generous ,, thank you all Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 22, 2013 Share Posted February 22, 2013 You're very welcome! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.