Jump to content

proper way with Open Function


Tharwat

Recommended Posts

Hello,

(defun c:on (/ f txtline)
(if (setq f(open "c:\\my documents\\Drawing.dwg" "r"))
 (progn
(while (setq txtLine(read-line f))
(princ txtLine))
(close f))
(princ "\n Error - File was not opened.")
))

 

This Program dose not open the file which titled Drawing.dwg .

And what dose it mean read char or line somtimes "w"?

"r" - Reads a file with either read-char or read-line.

 

Regards,

Tharwat

Link to comment
Share on other sites

Look at the help file for 'open' the other modes are clearly explained.

 

w ~ open for writing

a ~ open for appending

 

Lee.

 

I am getting most of my information from Autocad Help, But nowadays Internet and Forums ,and I could not understand what will function open a drawing to write in?

Plus to append and reading chars for .....????

Thats why I am asking experts ...

 

Regards.

Link to comment
Share on other sites

The 'open' 'read/write line' functions will open a file as a text file. If you wish to manipulate entities in another drawing, use ObjectDBX.

Link to comment
Share on other sites

The 'open' 'read/write line' functions will open a file as a text file. If you wish to manipulate entities in another drawing, use ObjectDBX.

 

So what is the porpose of writing in a drawing or manipulating

with its entities ....?

 

Do you want to say that manipulating will get entitiy's settings from its dictionay to reuse it in the running Autplisp program....?

 

And writing will change entity's settings for a specific matter as well... ?

 

Regards

Tharwat

Link to comment
Share on other sites

Hi

 

The main issue still pending and not clear to me, I mean what is that thing or these things that will be read by 'open' ... and what's for ...?:unsure:

 

Any clarifications.

Tharwat

Link to comment
Share on other sites

The 'open' 'read/write line' functions will open a file as a text file. If you wish to manipulate entities in another drawing, use ObjectDBX.

 

 

Dear Lee,

 

What is objectDBX and how it will be useful? and where i can get help?

 

yours,

Muthu.

Link to comment
Share on other sites

Hi

 

The main issue still pending and not clear to me, I mean what is that thing or these things that will be read by 'open' ... and what's for ...?:unsure:

 

You can use open to read a files such as txt/csv/xls all being opened in text file format.

Link to comment
Share on other sites

Suppose you have an excel file has coordinate data (X, Y & X) and you want to use this data to draw a line using these data

So you use Open and then read these data

Write: You want to save data in an excel file

Am I in right direction Mr. Tharwat

 

Hasan

Link to comment
Share on other sites

Suppose you have an excel file has coordinate data (X, Y & X) and you want to use this data to draw a line using these data

So you use Open and then read these data

 

Write: You want to save data in an excel file

 

Am I in right direction Mr. Tharwat

 

Hasan

 

Yes, Now you are at the right rail forward.

 

Thanks for sharing

Link to comment
Share on other sites

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