Jump to content

saving data into properties


Recommended Posts

Hi,

 

Im really new to AutoCAD having always used so many different CAD packages before. Not too sure if this is posted in the right section but here I go:

 

I'm trying to write a script that saves the filename to the properties when I select objects.

 

E.g. I click on some lines and points. start the script. Then later when I click on any of those objects, I can see what the filename was in the properties panel.

 

Its usually due to the fact we combine many objects from different files and I wish to know where they all came from initally.

 

any help would be really appreciated.

~zhora

Link to comment
Share on other sites

Welcome to CADTutor, and congrats on your first post!

 

It sounds to me like you're interested in adding an XData (AutoCAD all versions), or Object Data (Verticals like Map, Civil 3D) custom property to the selected objects that do not already have a value.

 

I'm posting from my iPhone, but you can head over to the AutoLISP, Visual LISP & DCL forum for possible solutions.

Link to comment
Share on other sites

You could look into Xreferences for a non API meathod, otherwise I think that Renderman has it bang on.

Link to comment
Share on other sites

You can set XData in Express Tools, or you can run a LISP or VBA routine (as RenderMan said) to give all entities in the drawing an XData item that is the name of the drawing.

 

How would you deal with a new drawing in which you have imported entities from another drawing and have some new entities you created here? Would you want just the new entities to have the name of the new drawing and imported entities to have the name of their original drawing?

Link to comment
Share on other sites

You can set XData in Express Tools, or you can run a LISP or VBA routine (as RenderMan said) to give all entities in the drawing an XData item that is the name of the drawing.

 

How would you deal with a new drawing in which you have imported entities from another drawing and have some new entities you created here? Would you want just the new entities to have the name of the new drawing and imported entities to have the name of their original drawing?

 

Presumably, and I could be wrong, reactor(s) could evaluate each entity added to the drawing's database, adding the above mentioned data where not already present. In this hypothetical scenario, copying objects from one drawing to another *should* retain the original data's value (from the source drawing)... Just thinking out loud.

 

FWIW, that I see this as being a willful complication to an already complex process (i.e., Drafting, Data Management, Project Plans, etc.), and I personally would have no value from this being done for my projects.

Link to comment
Share on other sites

Presumably, and I could be wrong, reactor(s) could evaluate each entity added to the drawing's database, adding the above mentioned data where not already present. In this hypothetical scenario, copying objects from one drawing to another *should* retain the original data's value (from the source drawing)... Just thinking out loud.

 

FWIW, that I see this as being a willful complication to an already complex process (i.e., Drafting, Data Management, Project Plans, etc.), and I personally would have no value from this being done for my projects.

 

You are right, but I was just pointing out a problem. I wouldn't do anything like this too.

 

As a solution you could loop through all entities in the drawing and if an entity doesn't have the XData then attach it (drawing name). Its not a problem in LISP or VBA or .NET :wink: (BTW how's .NET coming along?)

Link to comment
Share on other sites

You are right, but I was just pointing out a problem. As a solution you could loop through all entities in the drawing and if an entity doesn't have the XData then attach it (drawing name). Its not a problem in LISP or VBA or .NET :wink:

 

No worries, I only jumped to the reactor conclusion to account for all objects added during the drawing session.

 

(BTW how's .NET coming along?)

 

Thanks for asking, Tyke! :D

 

I've cracked Visual Studio 2010 Express to launch Civil 3D, and debug properly, stopping at breakpoints, etc. (Eureka!),

 

Snippet from .vbproj:

 ...
 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
[color=blue]   <StartAction>Program</StartAction>[/color]
[color=blue]   <StartProgram>C:\[/color][color=#ff0000]<FilePath>[/color][color=blue]\acad.exe</StartProgram>[/color]
[i][color=black]   ...[/color][/i]
 </PropertyGroup>
 ...

 

I'm writing some basic 's in VB.NET and C#.NET, but have only began to experiment with scope of variables, stepping through selection sets, transactions, events, and creating custom tool palettes (populated by User Forms).

 

I have several ideas for enhancements (which also include WPF), but the gap between my idea, and the know-how to make it come to fruition is expansive, to say the least. :oops: LoL

 

Regardless of the decent aptitude I feel that I possess for Visual LISP (and I could be wrong?), I am quite literally a beginner with the .NET API.

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