Jump to content

LISP to get a 3d polyline to update itself by reading a coordinates (xyz) file


lm76gr

Recommended Posts

Hello all,

 

I have a txt/csv file with coordinates (x,y,z) from which I create a 3d polyline. I am looking for a way to update automatically this 3d polyline whenever the coordinates on the txt/csv file change. I suppose it is like linking the txt/csv file with the 3d polyline.

 

I cannot find a way of doing this using out-of-box AutoCAD/Civil 3D. I am hoping that somebody can either point me to the right direction (if such an option exists anyway) or possibly help me with LISP or VB in order to achieve this. My programming knowledge is extremely limited unfortunately so any help would be very much appreciated.

 

Many thanks and looking forward to your replies.

 

Loukas

Link to comment
Share on other sites

I haven't explored all the options, but perhaps you can create a link using the DataExtraction command.

 

Thank you for your reply.

 

This was the first thing I tried but it doesn't have x,y,z option and it doesn't have a link option. I have the feeling that this option was created for tables, not for objects. Please correct me if I am wrong because maybe I am missing something here.

 

From what I have read so far, the only way to achieve this is via LISP or VB.

 

Thanks,

 

Loukas

Link to comment
Share on other sites

I doubt there is a way through LISP to automatically update the set of Polylines following modification of the txt/csv file, since, even if a reactor were used for this purpose, evaluation of the reactor callback function would not be trigggered by any event outside of AutoCAD.

 

Hence, the program being used to update the Polylines would either need to be run manually following changes to the file, or alternatively, run when the drawing is opened, whether the file has been modified or not.

 

There are various ways to use LISP to update the polylines, depending upon the amount of information in the data file. If, for example, entity handles are stored in the data file, the individual polylines associated with these handles could be modified to reflect the coordinates found in the file. Otherwise, the polylines would have to be deleted and recreated using the modified data.

 

Just putting some thoughts out there.

 

Lee

Link to comment
Share on other sites

I think I didn't explain properly and I created a confusion. Yes, you are right. In order to update the 3d polyline I will need to run the LISP manually. This is exactly what I would like to do. Once I get a txt or csv file with the new coordinates then I will run the LISP and then the 3d polyline will be updated.

 

I do apologize for the confusion. And many thanks for the ideas. It sounds like what you suggested would actually do what I am looking for.

Link to comment
Share on other sites

Anybody out there got the Shaft.dwg and excel spreadsheet demo around Autocad R12 change a value in excel your dwg changes. maybe this would provide a link to a 3dpolyline. I do not have a copy.

Link to comment
Share on other sites

Anybody out there got the Shaft.dwg and excel spreadsheet demo around Autocad R12 change a value in excel your dwg changes. maybe this would provide a link to a 3dpolyline. I do not have a copy.

 

I have tried to locate this drawing you mentioned but I can't find it anywhere. Does anyone have it?

 

Any more ideas regarding the 3d polyline update anyone?

Link to comment
Share on other sites

I doubt there is a way through LISP to automatically update the set of Polylines following modification of the txt/csv file, since, even if a reactor were used for this purpose, evaluation of the reactor callback function would not be trigggered by any event outside of AutoCAD.

 

[VisualStudioSpeak]

Sounds like an interesting Method idea for the .NET Event/Delegate gurus. :wink:

[/VisualStudioSpeak]

Link to comment
Share on other sites

I am working on a VBA routine that will update the 3d polyline. Once tested, I will post the code here. Any comments on the code or improvements are very welcome and much appreciated

 

@RenderMan

 

Thanks for the files!

Link to comment
Share on other sites

I am working on a VBA routine that will update the 3d polyline. Once tested, I will post the code here. Any comments on the code or improvements are very welcome and much appreciated

 

That's cool, just be warry of the fact of using VBA in lieu of VB.NET, as at some point you're going to need to port your VBA code over to VB.NET using Autodesk's Magic Macro.

 

I've not yet had to go through this process, as I'm jumping straight into Visual Studio 2010 Express. However, as I understand it the VBA code has to be ported to Visual Studio 2008, then the resultant VS project can be opened by VS 2010. Just a thought.

 

Otherwise, good luck!

 

@RenderMan

 

Thanks for the files!

 

Eldon, I think this was meant for you, my friend. :whistle:

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