Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic System Architect (steve huntington)
Decrease font size
Increase font size
Topic Title: Method for Diagram Duplication?
Topic Summary: How to create a new diagram with new definitions from an existing diagram
Created On: 13-Sep-2006 14:01
Status: Read Only
Linear : Threading : Single : Branch
1 2 Next Last unread
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Jonathan Burlingame, on Thursday, September 21, 2006 4:37 PM

Answer:
Haha, sorry Matt!

This is what I ended up doing to duplicate diagrams and all their symbols and definition. I put an "instance identifier" in the name of everything. For instance, let's say that one of the original diagrams is "Diagram 1" with symbols "Symbol 1" "Symbol 2", etc. The original is going to be "instance A". I want to create 7 total instances, so I have "instance A" through "instance G". I named everything in the original like this: "Name - Instance A". Every diagram, every symbol, everything has an instance identifier in the name.

Next I exported the XML of every diagram that I wanted to duplicate and opened it up in a text editor. I did a find and replace on the instance identifier (be sure to use an editor that supports find and replace!). For instance, I found every occurence of "instance A" and replaced it with "instance B". Then I simply re-imported the XML and had a second instance of everything. Repeating this 5 more times using "instance C" and so forth, I ended up with all 7 instances that I needed.

You do not have to worry about SAObjID values overlapping and such, which is great. When SA imports something from XML (and you select never replace in the dialog - I've never tried it any other way) it only uses the SAObjID to understand relationships within the XML file. You can make the SAObjIDs anything practically (0-65535 is my guess on the valid range) as long as they are unique within the file. When the objects are created within SA, they are assigned new SAObjIDs according to what is next in that SQL DB.

Also, you can make the instance identifier something reasonable. If say, you are modeling 7 different locations which all have the same processes, you may use the cityname as the identifier or something. At least then it doesn't look like you have things named wierd. This method was less than ideal because it forces you to name things certain way to make it feasible but it's certainly better than duplicating scores of diagrams and hundreds of symbols by hand.
 13-Sep-2006 14:01
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

I need to create an OV-05 Node Tree that at the top level has 7 children. Each child is decomposed into about 10 child diagrams which each contain 3-25 symbols. Each of the 7 children are Identical save for one thing, they each represent a different instance of that hierarchy.

For example, the top level looks like this:

root
a b c d e f g


The symbol 'a' has a child diagram that further decomposes it, and this continues so that there are about 10 diagrams under object 'a' totaling about 100 objects. Each object is named "a - XXXXX" where 'a' indicates that the object belongs to the 'a' instance and XXXX is the rest of the name. What I need is to have all the other children (b-g) have the same structure underneath them, except their diagram and object names would be "b - XXXXX", "c- XXXXX", so forth.

Creating the new duplicate objects is a cinch, I just exported the definitions to a CSV, copy and pasted them, did a find and a replace, and re-imported all the objects. However, the problem arises when I want to copy the Diagrams. Initially I thought I would do all this by creating the structure once, exporting the XML, doing a find and replace to replace 'a' with 'b', and re-importing the XML. The problem there is that there are all kinds of unique fields in the XML (like SAObjID) that must be Different and unique. You can't simply do a find and replace in the XML and end up with a second copy of the diagram (at least I don't think). It would require you to manually edit every object (SADefinition, SADiagram, SASymbol) in the XML to remove the unique fields and such.

So my question is, have any of you had a similar situation and how did you handle it?

Certainly I could just create all the new diagrams and reconnect all the symbols that I imported from the CSV file but this will be extremely tedious (over 600 objects). The only thing I could think of was to create it Visio, do a find and replace in Visio each time, and re-import the Visio diagrams. Unfortunately, since there are 10 diagrams x 6 and the Visio import isn't the fastest, that wouldn't save much time. In the meantime, I guess I'll write a VBA script to address this specific issue.

Thanks!

Edited: 13-Sep-2006 at 14:05 by Jonathan Burlingame
Report this to a Moderator Report this to a Moderator
 13-Sep-2006 20:20
User is offline View Users Profile Print this message


Matt Sheranko

Posts: 82
Joined: 7-Oct-2005

Jonathan,
I would also like to do this.

Using VBA, I can create diagrams, set their properties and create symbols and the symbols' definitions.

I can not figure out how to set the relation for the Operational Activities on the OV-5 Node Tree.  The only way I know how to set that relation is to manually do it.  PAINFUL. There must be a way to use the Hierarchical numbering property to set the relation between operational activities.  Can anyone help with that.  If so, then we can write the code to create an OV-5 node tree diagram with symbols and the symbol's respective definitions.

You said you exported and imported "Symbols"?  How did you do that.  I thought you could only import/export definitions?  Or were you planning to use the XML import/Export to get symbols and definitions?fficeffice" />>>

> >



-------------------------
Thanks,

MattS
Report this to a Moderator Report this to a Moderator
 13-Sep-2006 20:36
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

I just started writing an application to handle duplication of a diagram, so I may have an answer soon for the relation question. One thing you might look at is the Visio Mapper as they do create links there (however, those are actual link objects, not a relation).

You're right, you cannot actually Import/Export symbols through CSV (you can through XML). What you are actually doing is importing and exporting the definitions. However, once I created all 700+ definitions in the CSV file and imported them, they are in the "choices" menu to be dropped on to the diagram.

The application I am writing is in C# using the COM interface. I really don't like writing things in VBA for a number of reasons and I have a lot of utilities and such that I have built in class libraries that I reuse all the time in .NET, so I prefer going this route. I am not at liberty to share those, however if I get the C# application to duplicate the diagrams, I'll paste what code I can for reference.

Oh, and the problem with using the XML for the symbols/definitions is the same as what I had previously mentioned - the unique field values that are present like SAObjID and such. Since SAXML isn't very nice, doing a transformation on it to create a duplicate is sortof out of the question given my current level of effort.
Report this to a Moderator Report this to a Moderator
 13-Sep-2006 20:50
User is offline View Users Profile Print this message


Matt Sheranko

Posts: 82
Joined: 7-Oct-2005

Jonathan,

Thanks for the pointer to the visio mapper, maybe I can figure it out from there.  VBA is well within my scope of capabilities...I'll try the easy stuff before those new fangled languages with just one letter in their name.  ;-)

Keep me posted if you do find a way in COM to create the relation or link.


LINK to visio mapper 2.1.

https://support.telelogic.com/en/request/content/getfile.cfm?contentid=12268&fileid=5714

  Lots of good sample VBA, but does not convert a vsd (org chart) to an ov-5 node tree.  It does move symbols, but does not move the "lines" and relations of nodes.  Back to hacking the XML export?



-------------------------
Thanks,

MattS

Edited: 14-Sep-2006 at 19:02 by Matt Sheranko
Report this to a Moderator Report this to a Moderator
 14-Sep-2006 13:28
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

Sure thing, I'll post any solution to creating a relation if and when I find it.
Report this to a Moderator Report this to a Moderator
 14-Sep-2006 20:25
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

Hrmn, I beginning to wonder if the "link" symbol is stored ONLY in the DGX file. I've found out what relationships have to be created in order to make the hiearchy for the OV-05 NT and my code is matching the results of me doing it through the SA GUI exactly when I check in the DB tables. This makes me think that the SA GUI may also programmatically add the appropriate lines in the DGX file of the diagram and not draw that line based on the presence of the proper relationship entries. This will disgust me if this is indeed the case.
Report this to a Moderator Report this to a Moderator
 14-Sep-2006 21:27
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

I looks like I may be able to generate the links without generating the relationships directly in the DB. There are a number of functions in the ISAIMF object that deal with trees (such as SACreateTreeSymbol and SACreateTree, SAInsertNodeAfter, etc.). I need to play around with these for abit because I can't seem to get them to display on a diagram.
Report this to a Moderator Report this to a Moderator
 16-Sep-2006 13:57
User is offline View Users Profile Print this message


Matt Sheranko

Posts: 82
Joined: 7-Oct-2005

Jonathan,
Hopefully the coding goes well.  I am attempting to reverse engineer the exported XML docs to see if there is a minimum subset of data that will build the diagram and nodes, and then let SA "update" the rest of the internally set fields.  Your are correct that there are no "line symbols" on the ov-5 node tree diagram.

I want to be able to programmatically create and then generate an ov-5 node tree from data I already have.  I can build diagram, create symbols/definitionas, put symbols on the diagram, just can't set the relationships.



-------------------------
Thanks,

MattS

Edited: 16-Sep-2006 at 13:59 by Matt Sheranko
Report this to a Moderator Report this to a Moderator
 17-Sep-2006 19:28
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

Take a look at these attributes for an SASymbol object in the XML. I think they some, if not all the attributes necessary to define the hierarhical relationship for a symbol:

UPDATE: These below are not entirely correct. Look further in the thread for the Updated Property Definitions post that has the most up to date definitions and the necessary fields.
SASymArrangement="0"
SASymOrder="0"
SASymXPEntity="3"
SASymXPLink="65535"
SASymXPGroup="65535"
SASymXPSibling="2"
SASymXPSubordinate="65535"


SASymArrangement: I think this attribute determines how to arrange the children

(vertically, horizontally, or as a block).

SASymOrder: I'm not exactly sure what this one does. It does change and the root node has a value of 0 but I've not yet figured out what this value does.

SASymXPEntity: I believe this is the entity number of the symbol. It's

used by other objects in the hierarchy to reference to them.

SASymXPLink: I *think* this links to a child diagram or something (which would be kind of odd since I think there is another property or attribute that links to child diagrams).

It's always INT MAX (65535) in all my diagrams which I believe is the

"Undefined" value.

SASymXPGroup: This basically says who the parent is. It's the SASymXPEntity value of the parent object.It's 65535 (int max) if it's the root of the tree on that diagram.

SASymXPSibling: This is the SASymXPEntity value of the sibling on the right of the symbol. A symbol may have 0 or more siblings to it's left or 0 or more to it's right, but this just points to the next one to it's right. It's 65535 (int max) if there is no sibling

SASymXPSubordinate: This is the SASymXPEntity value of the left most child of the symbol. A symbol can have 0 or more children, but this points to the leftmost child on the diagram. It's 65535 (int max) if there are no children.


As far as the Visio mapper goes, yeah it only creates the nodes not the hierarchical relationships. I may do it via XML but I have to determine if it's easier to mangle the XML programmatically to create the duplicates or to do the entire thing programmatically. I'm working on something else right now and have a question submitted to tech support, so maybe they'll answer it in the interim. I'll be revisiting this issue this coming week and I'll let you know what I find.

Edited: 20-Sep-2006 at 12:31 by Jonathan Burlingame
Report this to a Moderator Report this to a Moderator
 18-Sep-2006 14:03
User is offline View Users Profile Print this message


Matt Sheranko

Posts: 82
Joined: 7-Oct-2005

Jonathan,

Thanks again for the update.  I did some minor testing and am getting close.  I currently have a list of nodes numbered hierarchically:  1, 1.1, 1.1.3, 1.1.n etc.

Using VBA, I will create a diagram, create symbols/definitions and place them on the diagram and then save the diagram.  That allows SA to create all object attributes etc.  Then, I will export the diagram to XML, update the attributes that specifically create the relations, and re import the diagram's xml.  This works on a very small number of nodes now.  It is a hack, but seems to work on a small scale with limited testing.

One thing that I noticed is that if you delete the value of the DGX path attribute, the new Imported diagram with relations works,  otherwise it simply uses the old DGX file without the relations.



-------------------------
Thanks,

MattS
Report this to a Moderator Report this to a Moderator
 18-Sep-2006 14:10
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

Hrmn, I had speculated that the relational link lines were only contained within the DGX and were created programmatically and what are saying seems to support that. If that's true, I wonder if the methods I was trying earlier would work if I just delete the DGX when I was done so that it had to be re-generated.

Btw, are the attributes that I spelled out the ones you need to create the hierarchy or did you need additional/fewer ones?

Thanks.
Report this to a Moderator Report this to a Moderator
 18-Sep-2006 14:36
User is offline View Users Profile Print this message


Matt Sheranko

Posts: 82
Joined: 7-Oct-2005

Jonathan,
I think there were one or two more attributes that I modified, based on changes I saw when modifying diagram/symbols and then exporting new XML for diagram.  Not sure if they are completely necessary.  I did find out that SA is very picky about needing almost all of the attributes in the xml doc for a good import.

I am working this over next couple of days and will post what I find out.  You were right on the money for the attributes that you listed previously.

PS.  Anyone know why I am constantly double posting?  I see a few people do it.  It must be my user configuration in the forum?



-------------------------
Thanks,

MattS
Report this to a Moderator Report this to a Moderator
 18-Sep-2006 14:47
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

Good deal. I have noticed that you need to specify nearly everything as well.

Dunno why you are double posting, but like you said - several others do as well.
Report this to a Moderator Report this to a Moderator
 19-Sep-2006 23:34
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

OK, I have some info for the update. I've found that you can create a diagram from very little XML and you can create a symbol from very little as well. I've found that it doesn't really matter what SAObjID you use in your XML so long as it is unique WITHIN the XML document. If you use say, 1 or 2000, and those IDs are not the inline with what IDs should be used next, it just replaces them with valid new ones. It does use IDs within the XML to determine relationships though. If you completely leave the IDs out then you can't establish relationships and if you have more than 1 of the same object type (e.g. SASymbol or SADiagram) then they are considered duplicates.

Minimum Diagram XML

Edited: 19-Sep-2006 at 23:37 by Jonathan Burlingame
Report this to a Moderator Report this to a Moderator
 19-Sep-2006 23:34
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

Minimum Symbol XML
Report this to a Moderator Report this to a Moderator
 19-Sep-2006 23:48
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

duplicate post

Edited: 20-Sep-2006 at 00:00 by Jonathan Burlingame
Report this to a Moderator Report this to a Moderator
 19-Sep-2006 23:54
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

duplicate post

Edited: 19-Sep-2006 at 23:59 by Jonathan Burlingame
Report this to a Moderator Report this to a Moderator
 19-Sep-2006 23:56
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

This is where things get interesting. The XML code below will create an OV-05 Node Tree diagram with 6 nodes. If you import the XML and look at the diagram it creates and the XML itself, you'll notice several things.

UPDATE: These below are not entirely correct. Look further in the thread for the Updated Property Definitions post that has the most up to date definitions.
SASymXPEntity - This is the unique ID that other symbols use to reference this symbol
SASymXPGroup - The SASymEntity value of the parent symbol or 65535 if it has no parent
SASymXPSibling - The SASymEntity value of the symbol's sibling to the immediate right
SASymXPSub - The SASymEntity value of the symbol's leftmost child
SASymXPLink - I have no idea, its always none (65535)
SASymXPOrder - The value of the node if you do a pre-order traversal of the hierarchy starting with 0 for the root node
SASymProperties - I have no idea what this does, but it's definitely important. If you look at the diagram and look at the XML, I can't figure out the what the value does or what it should be for any particular node just using the relationships and locations of the node in the tree. If you get this wrong however, at best your diagram is wrong and at worst it crashes SA (make them all 0x0001 for instance).

Any ideas?

P.S. Don't forget to save the file in the Unicode encoding or change the encoding value to UTF-8 or else it will error when you try and import.

Edited: 20-Sep-2006 at 12:30 by Jonathan Burlingame
Report this to a Moderator Report this to a Moderator
 19-Sep-2006 23:57
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

duplicate post

Edited: 20-Sep-2006 at 00:00 by Jonathan Burlingame
Report this to a Moderator Report this to a Moderator
 19-Sep-2006 23:57
User is offline View Users Profile Print this message


Jonathan Burlingame

Posts: 52
Joined: 1-Aug-2005

duplicate post

Edited: 19-Sep-2006 at 23:59 by Jonathan Burlingame
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic System Architect forum.
There are currently 0 users logged in.
The most users ever online was 16 on 30-Oct-2008 at 14:46.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.