rusi55 Posted February 20, 2016 Posted February 20, 2016 Hello everybody, I finally decided to write my first LISP procedure, and it generally works... Hurray! Nevertheless, as I came up with an idea to make it even more convenient (to cooperate with Excel VBA), it looks like it's not as super as i would like to: I use this command in LISP to insert my main block in set of blocks (the other are just graphic objects - there is no problem with them): (command "_insert" "Listwa_Zac_Start" insertPt1 "1" "1" "0" NazwaListwy AtrSrd "" AtrKabelOzn "" AtrKabelDane "") where: Listwa_Zac_Start - name of block insertPt1 - insert point gotten earlier from user "1" "1" "0" - scale X, scale Y, rotation NazwaListwy - title (single line attribute gotten from user) AtrSrd - multiline attribute (example: 1\n2\n3\n4\n5\n6\n7\n...) AtrKabelOzn multiline attribute (example: W1\n\n\nW2\n\n\nW3...) The problem is that, after making this block's attributes export to txt file using express tool, instead of getting string like for example 1\P2\P3\P4\P5\P6\P7\P... as it looks when i insert this block step by step and edit attributes manualy, I am getting sth like that: 1 2 3 4 ... which is really bad as it even stays in wrong column (in txt file). The problem is of course with all multiline attributes created like that. So the question, how to make this attribute so that I will get "normal" output txt file after that? If you need the sample of dwg lisp or txt I can upload it of course, it's just that I am pretty sure, that the problem is with this line Thanks in advance for any smart ideas Regards rusi55 Quote
BIGAL Posted February 20, 2016 Posted February 20, 2016 Using a lisp will return the "textstring" as per this example (foreach att (vlax-invoke (vlax-ename->vla-object (car (entsel "pick block"))) 'getattributes) (alert (vla-get-textstring att)) ) Quote
rusi55 Posted February 21, 2016 Author Posted February 21, 2016 So it does - for existing blocks, it returns the same strings as Express/export (described in first post). For attributes edited manualy it returns "/P" as next line symbol, but for those attributes created by complete insert command (described in first post) it returns next line, as... next line. I attach screenshots of the result. The question is, how change insert command so does it uses "/P" as next line symbol? Quote
BIGAL Posted February 22, 2016 Posted February 22, 2016 Post a dwg should be able to manipulate the answer back into a single line of text. Quote
Tharwat Posted February 22, 2016 Posted February 22, 2016 As BIGAL said , upload a sample drawing and post the outcome you looking for when exporting attributes to txt file as mentioned in your first post. Quote
rusi55 Posted February 22, 2016 Author Posted February 22, 2016 As BIGAL said , upload a sample drawing and post the outcome you looking for when exporting attributes to txt file as mentioned in your first post. Thanks for your interest, here it goes: Block X1 is made using entirely my procedure => results in next line symbol as next line, X2 is made by editing attributes manually => next line symbol is "\P" and that's how i would like it to be done by procedure also. It applies to attributes: ZACISKI_SRODEK, I would like to get in this example: \W0.8000;\pxa0.3334;1\P2\P3\P4\P5\P6 KABEL_GORA, I would like to get in this example: \W0.8000;\pxa0.3334;W1\P\PW2\P\PW3 KABEL_DOL, I would like to get in this example: \W0.8000;\pxa0.3334;abcd XxXX\P\Pabcd XxXX\P\Pabcd XxXX I attach you: -dwg sample: sample.dwg -Lisp procedure (comments are in Polish, but I am pretty sure you will not have problems with such an easy task): Zacisk.LSP -txt export file (X1 is inappropriate, X2 is how I would like it to be): sample.txt As I mentioned earlier that's my first LISP, so any good hints for future are very welcome (for examle I am having lately a problem that after procedure is complete the textscreen is shown in main ACAD window - I don't know how to avoid this). Quote
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.