Jump to content

Recommended Posts

Posted

Hi

 

Let me first confess that I'm not a professional, but in other programming languages which I'm good at this was my learning curve. I started to do a project and learned stuffs I needed in that. I'm doing this on lisp too, of course I'm not all noob but not yet conversant.

 

There are some basic questions I have. There is two type of data, some that are general through all of the project and some have to stick to entities. There are some functions that are directly used and some utilities functions. If this was in something like c++ a namespace would have been very useful. As there are multiple files is there a way not to make utility functions command version with c: and use them in other files?

 

To hide the data from user in order to prevent interference with the standard procedure, I guess the best choice is extended data for entity specified and dictionaries for global variables in the program, right? for extended data you should assign all the same variable types only to the determined numbered code, this makes it hard to manage. dictionaries are hard to manage intrinsically themselves. Is there any other ways to add data? (making block attribute is not a good idea for the program structure)

Posted

A bit confused between the heading and the post. A VLX is a compiled lisp collection file. This can be compiled to have its own namespace and then you can set which defuns inside that VLX is visible outside its own namespace: vl-doc-export.

 

Your post however is referring to data stored in entities. There is only the 2 methods (XData / XDictionaries). There are some useful routines around here and on other forums which makes manipulation of these a lot easier. Or you could simply use the vlax-ldata-* functions, they actually use dictionaries to store data into. These dictionaries may be attached to the drawing itself (as a named object dict) or attached to any other object inside that drawing.

Posted

Well I'm going to finish my work as vlx and hand it to others, that is the reason of the topic, but you are right, it was better to break it in different topics.

 

However let me ask the main question I had in this topic: if I have multiple files and want to save all the utility functions in a file in order to use it in other files, what should I do? is it enough to add them all in a project?

 

Thanks about the data thing, I guess the vlax-ldata are the best for me

Posted

If those utility functions are used only inside your VLX project, then simply adding them in should do fine. If you need to use them in other projects, then either add them in similarly to those VLX's or compile them to a VLX without namespace.

 

You see in VLisp a VLX can have a namespace, but only one. And if so, then everything inside it is in that namespace. If you want something to be visible outside the namespace (i.e. in the document's namespace) then you use vl-doc-export on such. If the VLX is not set to a namespace, it would be as if you vl-doc-export'ed every defun inside.

Posted

Thanks, until now I was using only lisp files, and in order to use a function from one file in another one I had to make it prompt accessible. Thanks a lot

 

I have another question: what do you do if you want to attach a dwg file to your project? I need it to insert in drawings as block

Posted
Thanks, until now I was using only lisp files, and in order to use a function from one file in another one I had to make it prompt accessible.

 

You can still access functions from other LISP files without the need to use 'commands' (i.e. functions prefixed with 'c:'), just ensure the LISP file containing the library functions is loaded into the document namespace before attempting to call the functions.

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