Author Topic: Convert string to list?  (Read 17502 times)

0 Members and 2 Guests are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Convert string to list?
« Reply #45 on: October 04, 2012, 05:38:44 AM »
Brick_top ,

What is the actual purpose of saving this data ??

What do you intend doing with these saved entities ??

How often do you want to save them ?

How often will you want to restote them ?

Will any restore be a full restore or partial ?

How many people in your group will be writing data ?

Will you me writing from one model/control  drawing or from several ?

How many drawings in the project ?


This might seem like a lot of questions, but these are things that will govern your best solution design.


Personally I think you will be best served doing a Wblock of selective DXFOut of the relevent entities ... but that belief may change depending on your intent.


Regards
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Brick_top

  • Guest
Re: Convert string to list?
« Reply #46 on: October 04, 2012, 06:47:48 AM »
Brick_top ,

What is the actual purpose of saving this data ??

I wanted a way to have a drawing revert to several versions defined by me in another routine I have to save development notes. Withouth having severall full versions of the drawing saved in disk.

What do you intend doing with these saved entities ??

I would like to say that each version of a drawing is related to a note I made and if I want I can have the drawing revert to that state

How often do you want to save them ?

As often as some revision is made to the project

How often will you want to restote them ?

As often as requested by anyone who wants to see another version of a drawing.

Will any restore be a full restore or partial ?

I don't think there will be a full restore, if it happened it would be extremely rare

How many people in your group will be writing data ?

I'll be the only one writing data

Will you me writing from one model/control  drawing or from several ?

I don't know if I understand this question correctly, but every entity would only be reverted to its original creation drawing.

How many drawings in the project ?

This would be only to work in one drawing at a time, to show its several versions. Every drawing would have its own notes and versions saved to its own saved versions

This might seem like a lot of questions, but these are things that will govern your best solution design.


Personally I think you will be best served doing a Wblock of selective DXFOut of the relevent entities ... but that belief may change depending on your intent.

Regards

I don't know if you read a post I made in this thread that I think oultlines my ideia, maybe you read it but I didn't explain myself correctly.

Here is what I said.

Quote
This is my ideia of how it could work?

With each Note I would have to save to xrecord which version is currently in use and which are the entities that it contains.

For Example:

Note 2 Is composed by entities number x to x from note 1 and entities number x to x from note 2. I guess I would also have to keep adding to every note which entities are to be deleted.
because I know which version is currently in use I know what entities are already drawn and which are to be deleted.

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

When creating Notes and defining what entities belong to which version:

Note 1 - Would save a txt file for Note 1 with the numbered entities from Note 1 and save to xrecord that version from note 1 is in use and contains entities from number x to x from note 1.

Note 2 - For Note 2 I would compare every entity in the drawing against the ones that are saved in the txt from Note 1. I would then save to note 2 the new entities that are to be drawn. I will save to xrecord that Note 2 contains entities number x to x from Note 1 and number x to x from Note 2. I would also save the entities that are to be deleted from Note 1.

At this time I realize that acoording to which version currently in use and the one I intend to draw I must also save what entities are to be deleted according to the version currently in use.

Note 3 - Would have to compare the existing entities against Notes 1 and 2 to check which ones are to be drawn and deleted.

As of now I'm not thinking of any other problem that may arise... But I guess I'm sure there could be plenty.


I'm sorry if I'm giving you guys a lot of work.

I'm thinking this isn't very feasible or worth the trouble.

« Last Edit: October 04, 2012, 06:52:35 AM by Brick_top »

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Convert string to list?
« Reply #47 on: October 04, 2012, 03:08:50 PM »
It does sound like a big job. Though it might not be entirely impossible. The point about which codes to save or not, is not an easy one to answer, especially not in the case you're referring to:

I.e. you want a record of created, modified and/or erased entities, to allow a persistent partial-undo to be performed to any one of the variants?

If that's the case, then the "simplest" solution would be using a wblock (as someone's suggested previously), actually I'd go this route since IMO it's also the "best" solution. Basically, you'd select the object(s) and wblock selected to a new filename (you can calculate such name from something like the current date/time). Then if you need any further data for such (e.g. who performed the change, or any comments made for such), that can be saved into a TXT file with the same name, or you can add it as DWG propery into the WBlocked DWG file through ObjectDBX. All this can quite easily be automated through lisp (both the WBlocked DWG and the TXT). Not to mention, the wblock would handle the "What codes to save out" for you, actually DXFOut would do the same, but if you're doing it RAW in lisp to a txt file - you'd need to figure these out through trial-n-error. Not to mention: those ENames (which can't be read back) still needs to be saved out somehow - they refer to stuff like linked entities / dictionaries / object data / etc. So if you leave such out, you won't be able to return to a exact state for that entity - it might have "lost" some info in such process (this is why I say it would be trial-n-error).

If you're really pressed on disc space, then saving only the actually needed data into a TXT file "might" help ... though I'm not sure it will actually be smaller than the WBlock in all instances. The txt file saved from lisp would be very similar in size to a DXF file (as done through the SaveAs / DXFOut command) - at least if you save all the relevant data such as Layers/Styles/Blocks/Dictionaries/XData/etc. The reason I'm saying this is the DWG file created using WBlock is a normal Binary DWG file, and the newer ACads (I think since 2005) uses a form of compression (similar to ZIP) to reduce the filesize even further, the DXF/TXT on the other hand is very wasteful on space (e.g. in the binary it might use something like 2 bytes to store an integer code for what type of entity it is; but in DXF the entire Entity Name needs to be saved, one byte per letter - not to mention some form of stating what this portion of the file relates to). So even for the possible space-saving by omitting unneeded data, I'd think twice about going this route: lots of work for possibly even larger files.

If you really want it to be as small as possible, then you might rather want to generate a binary file of your own design. And in such case you might have to look into using DotNet (or at the very least some ActiveX streaming library through Visual Lisp). In which case you can even use some compression libraries to make that binary file even smaller than the DWG could possibly be. This I'd go for only as an extreme last resort - if you've got this type of problem with size, then you need to look elsewhere for easier / better / cheaper solutions like buying a NAS box with 16TB of storage  :lmao:
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Brick_top

  • Guest
Re: Convert string to list?
« Reply #48 on: October 08, 2012, 05:21:16 AM »
It does sound like a big job. Though it might not be entirely impossible. The point about which codes to save or not, is not an easy one to answer, especially not in the case you're referring to:

I.e. you want a record of created, modified and/or erased entities, to allow a persistent partial-undo to be performed to any one of the variants?

If that's the case, then the "simplest" solution would be using a wblock (as someone's suggested previously), actually I'd go this route since IMO it's also the "best" solution. Basically, you'd select the object(s) and wblock selected to a new filename (you can calculate such name from something like the current date/time). Then if you need any further data for such (e.g. who performed the change, or any comments made for such), that can be saved into a TXT file with the same name, or you can add it as DWG propery into the WBlocked DWG file through ObjectDBX. All this can quite easily be automated through lisp (both the WBlocked DWG and the TXT). Not to mention, the wblock would handle the "What codes to save out" for you, actually DXFOut would do the same, but if you're doing it RAW in lisp to a txt file - you'd need to figure these out through trial-n-error. Not to mention: those ENames (which can't be read back) still needs to be saved out somehow - they refer to stuff like linked entities / dictionaries / object data / etc. So if you leave such out, you won't be able to return to a exact state for that entity - it might have "lost" some info in such process (this is why I say it would be trial-n-error).

If you're really pressed on disc space, then saving only the actually needed data into a TXT file "might" help ... though I'm not sure it will actually be smaller than the WBlock in all instances. The txt file saved from lisp would be very similar in size to a DXF file (as done through the SaveAs / DXFOut command) - at least if you save all the relevant data such as Layers/Styles/Blocks/Dictionaries/XData/etc. The reason I'm saying this is the DWG file created using WBlock is a normal Binary DWG file, and the newer ACads (I think since 2005) uses a form of compression (similar to ZIP) to reduce the filesize even further, the DXF/TXT on the other hand is very wasteful on space (e.g. in the binary it might use something like 2 bytes to store an integer code for what type of entity it is; but in DXF the entire Entity Name needs to be saved, one byte per letter - not to mention some form of stating what this portion of the file relates to). So even for the possible space-saving by omitting unneeded data, I'd think twice about going this route: lots of work for possibly even larger files.

If you really want it to be as small as possible, then you might rather want to generate a binary file of your own design. And in such case you might have to look into using DotNet (or at the very least some ActiveX streaming library through Visual Lisp). In which case you can even use some compression libraries to make that binary file even smaller than the DWG could possibly be. This I'd go for only as an extreme last resort - if you've got this type of problem with size, then you need to look elsewhere for easier / better / cheaper solutions like buying a NAS box with 16TB of storage  :lmao:

I'm sorry for only replying today, I just returned to work.

I'm feeling guilty for opening this thread now... Is there a limited number of times to ask for help in this place?

The question about notes I think is already solved. The thing about rebuilding the drawings is supposed to be added to a routine I have that handles these development notes.

If I may show here is how it works.

Here are the options to See Notes/add Notes - "Ver Notas/ Adicionar Notas"



I can then choose to add a Note:

Where it says "Criar Imagens?" Means I can choose to take slides of the state of the drawing and "attach" them to the Note.

Numero de Slides a criar? Its for me to input the number of slides I which to create.



When I choose to See the Notes:

The little pull down menu is used to show the slides I saved in the corresponding Note.



||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

I also Have a "Master file" in which I also record at its creation time the notes that describe each drawing so I can later search and open a file I want.

Here is where I input what I want to search. In this case I wrote "Pacheco" which is the name of a person I work for.



If any result is found here is how they appear:

I can than choose to open a file pertaining to a note. In this case Note 37.



||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


What I would like is to replace the slides thing with the "Drawing versions" Idea.

What I'm not understaning about the wblock ideia is how would I compare the wblock entities from a note with new entities?

edit - very informative post, and by the way... what I know about ObjectDBX is I heard the word somewhere :(. by the way I also checked and a txt with the entities gets much larger than a dwg.
« Last Edit: October 08, 2012, 05:44:01 AM by Brick_top »

kruuger

  • Swamp Rat
  • Posts: 633
Re: Convert string to list?
« Reply #49 on: October 08, 2012, 05:57:57 AM »
for compare dwg you need separate tool like:
- furix http://www.furix.com/comparedwg (there is a trial)
- http://apps.exchange.autodesk.com/ACD/Detail/Index?id=appstore.exchange.autodesk.com%3afastfilediff%3aen (there is also trial), i found few bugs, still no updated version.

could you post a sample dwg to see how big and complicated they are ?

kruuger

Brick_top

  • Guest
Re: Convert string to list?
« Reply #50 on: October 08, 2012, 06:16:03 AM »
I wouldn't like to use an external application to do this?

Here is a typical file of a project, I guess it is badly organized.

kruuger

  • Swamp Rat
  • Posts: 633
Re: Convert string to list?
« Reply #51 on: October 08, 2012, 07:07:23 AM »
I wouldn't like to use an external application to do this?

Here is a typical file of a project, I guess it is badly organized.
to wrote good compare program would be another problem.
and yes, dwg is real mess. there should be more blocks!

it doesn't look so big, maybe you should try my Xdata idea ?
kruuger

Brick_top

  • Guest
Re: Convert string to list?
« Reply #52 on: October 08, 2012, 08:48:37 AM »
You mean this one right?

there is something what might work but...dwg will be huge and heavy.
1. create a copy of ALL objects
2. when you create your Note1 point go thru all copies and add Xdata (Note1).
3. rename (with copy) all blocks to name_Note1
4. when add another NoteX follow step 1-3
using visibility properties show/hide notes with xdata
kruuger

When you say visibility properties you mean layer visibility right?

Problem might be that many times the projects suffer very small changes and for any change I would have a complete copy of the drawing. In case I understood your ideia.

kruuger

  • Swamp Rat
  • Posts: 633
Re: Convert string to list?
« Reply #53 on: October 08, 2012, 09:11:41 AM »
You mean this one right?

there is something what might work but...dwg will be huge and heavy.
1. create a copy of ALL objects
2. when you create your Note1 point go thru all copies and add Xdata (Note1).
3. rename (with copy) all blocks to name_Note1
4. when add another NoteX follow step 1-3
using visibility properties show/hide notes with xdata
kruuger

When you say visibility properties you mean layer visibility right?
no. i want use object visibility, dxf code 60. try attached program - HID

Problem might be that many times the projects suffer very small changes and for any change I would have a complete copy of the drawing. In case I understood your ideia.
ehh, yes. everywhere problems, problems, problems...
so combination of wblock and visibility:
- each note create "snapshot" of your dwg (separate file - wblock)
- when you back to previous note the whole drawing will be "turned off" (using visibility)
- temporary rename all blocks name
- then program will attach required file as an xref or insert as block
- back to latest version will detach all files (delete blocks), unrename blocks, turn on object

kruuger

Brick_top

  • Guest
Re: Convert string to list?
« Reply #54 on: October 08, 2012, 09:16:31 AM »
Maybe with xdata and wblock?

Assuming I can insert a drawing, explode it and compare it with entities from the same drawing:

I could add this xdata to these supposed objects:

Note 1 - e1
Note 1 - e2
Note 1 - e3
Note 1 - e4

...and wblock these entities.

Then along with the Note 1 description which I add to xrecord I would also add that Note 1 contains entities from e1 to e4, and that version from Note 1 is in use.

In Note 2

I would have to insert the wblock from Note 1 and compare it with the current version to check if any of the entities from Note 1 - e1 to e4 is missing.

If any is missing I would have  to add to xrecord that Note 2 deletes these entities. For Example Note 1 - e4.

Then any entities without xdata would be named:

Note 2 - e1
Note 2 - e2
Note 2 - e3

.. wblock again and store the filename in xrecord.

Then I would add to xrecord that version from Note 2 contains entities from Note 1 from e1 to e3 and entities from Note 2 from e1 to e3.

If all my assumptions are correct (big if) this could work I guess.



Brick_top

  • Guest
Re: Convert string to list?
« Reply #55 on: October 08, 2012, 09:23:56 AM »
You mean this one right?

there is something what might work but...dwg will be huge and heavy.
1. create a copy of ALL objects
2. when you create your Note1 point go thru all copies and add Xdata (Note1).
3. rename (with copy) all blocks to name_Note1
4. when add another NoteX follow step 1-3
using visibility properties show/hide notes with xdata
kruuger

When you say visibility properties you mean layer visibility right?
no. i want use object visibility, dxf code 60. try attached program - HID

Problem might be that many times the projects suffer very small changes and for any change I would have a complete copy of the drawing. In case I understood your ideia.
ehh, yes. everywhere problems, problems, problems...
so combination of wblock and visibility:
- each note create "snapshot" of your dwg (separate file - wblock)
- when you back to previous note the whole drawing will be "turned off" (using visibility)
- temporary rename all blocks name
- then program will attach required file as an xref or insert as block
- back to latest version will detach all files (delete blocks), unrename blocks, turn on object

kruuger

maybe this could work

kruuger

  • Swamp Rat
  • Posts: 633
Re: Convert string to list?
« Reply #56 on: October 09, 2012, 07:07:16 AM »
hi Brick_top

here is very rough sketch of what i describe
1. extract Note folder to drive D:
2. open latest.dwg
3. load lsp
4. type REC
5. select required Note
6. one xref overlay above another. it shouldn't be like that but i have a problem with refreshing screen when dcl is open
7. after cancel latest view is restored

kruuger
« Last Edit: October 09, 2012, 07:23:48 AM by kruuger »

Brick_top

  • Guest
Re: Convert string to list?
« Reply #57 on: October 09, 2012, 08:18:33 AM »
hi Brick_top

here is very rough sketch of what i describe
1. extract Note folder to drive D:
2. open latest.dwg
3. load lsp
4. type REC
5. select required Note
6. one xref overlay above another. it shouldn't be like that but i have a problem with refreshing screen when dcl is open
7. after cancel latest view is restored

kruuger

wow.. this is too cool man! Now I'm even more willing to do this

Brick_top

  • Guest
Re: Convert string to list?
« Reply #58 on: October 09, 2012, 08:27:20 AM »
Unfortunately this makes me realize how little I know about this... there is so much I don't understand in your routine that it hurts.

I just know a couple of things and my routines all revolve around that.


edit - by the way i don't find it necessary to change between versions while the routine is running. Only one optional rebuild per run is enough.
« Last Edit: October 09, 2012, 08:37:15 AM by Brick_top »

Brick_top

  • Guest
Re: Convert string to list?
« Reply #59 on: October 09, 2012, 08:31:13 AM »
Love the way you create the dcl without a separate file  :-o  Is there any problem with that approach?