Jump to content

Inadequate Express attribute export in block inserted with attributes defined by LISP


Recommended Posts

Posted

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

Posted

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)) 
)

Posted

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?

manual.PNG

LISP.PNG

Posted

Post a dwg should be able to manipulate the answer back into a single line of text.

Posted

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.

Posted
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).

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...