Jump to content

Recommended Posts

Posted

I'm trying to package a dxf file into a vlx, but I'm having problems with it. The extracted dxf is rejected by autocad.

 

I'm using it to add a block to the drawing if it doesn't exist.

 

 (if (= (tblsearch "BLOCK" "jkdatb04") nil)
(progn
	(setq dxf (vl-get-resource "kapcsjel"))
	(setq tempf (vl-filename-mktemp nil nil ".dxf"))
	(setq f (open tempf "w"))
	(write-line dxf f)
	(close f) 
	(command "_-insert" tempf "0,0" "" "" "")
	(vl-file-delete tempf)
  ));

 

Any suggestions?

 

If I compare the original dxf and the new one, there is indeed a 6 byte size difference, but the contents seems to be the same regardless.

Posted

Can be something related to formatting controls used in original and respectively new DXF files - I mean Carriage Return / Line Feed. Did you tried to open the new file with Notepad or other simple text editor? May find that all lines are condensed into single one and therefore the file rendered unusable by AutoCAD. Just a suggestion.

Posted
Can be something related to formatting controls used in original and respectively new DXF files - I mean Carriage Return / Line Feed. Did you tried to open the new file with Notepad or other simple text editor? May find that all lines are condensed into single one and therefore the file rendered unusable by AutoCAD. Just a suggestion.

 

Yes I opened it, and it seems identical, except the 6 byte size difference.

 

I've checked with a compare tool and it seems that some line feed characters are missing, but I have no idea why. And why only a few? I counted 4 missing.

 

http://mumia.uw.hu/compare.PNG

Posted

One workaround can be to try to convert the stored file into a single string by concatenating the lines with a separator – I suggest TAB (code ASCII 9). If the file size exceeds 32767 characters will require splitting into more than one string.

When need to record the target DXF file just replace the TAB-s with new line character – this way will avoid unwanted (not-supported) controls.

Posted

Thanks, it worked. I replaced the CR+LF with one TAB in the file. And then I switched the tabs to lf in the code.

 

(setq kapcsolojeldxf (vl-list->string (subst (ascii "\n") (ascii "\t") (vl-string->list (vl-get-resource "kapcsjel")))))

Posted

You’re welcomed @M76! I’m glad that was able to help you!

Regards,

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