![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Merge / join objects with links Topic Summary: Created On: 22-Nov-2007 11:25 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Peter, I've try the kitchen but it didn't copy the incoming links I have incoming links from several modules! The script i used is: //join.dxl /* Join selected objects on Object Text. Also move links from deleted objects to joined object. 1. Select a set of contiguous objects. (Only their object text will be retained.) 2. Run this script to replace the object text in the first of these objects with the concatenation of the object texts of the other objects, and then delete those other objects. */ /* Kitchen Tools for customizing DOORS with DXL V7.1 ------------------------------------------------- DISCLAIMER: This programming tool has been thoroughly checked and tested at all stages of its production. Telelogic cannot accept any responsibility for any loss, disruption or damage to your data or your computer system that may occur while using this script. If you do not accept these conditions, do not use this customised script. ------------------------------------------------- */ /* Modifications: Date: Who: Description: 07 Oct 97 jd Creation. 08 Oct 97 wc Changed object text separator to "\n". 15 Oct 97 jd Added copying of links to preserve them. 07 Apr 98 jd Delete objects in reverse order so that children are deleted before parents. 22 Sep 98 jd Preserve rich text. 08 Feb 05 jd Use full paths names for link modules. */ #include <addins/kitchen/utensils/dbs.inc> void moveLinks(Object fromObj, Object toObj) { // move all incoming and outgoing links from // one object to another int linksNotCopied = 0 // scan outgoing links Link l for l in fromObj->"*" do { // get link information Module lnkMod = module l string lnkModName = fullName(lnkMod) string trgModName = target l Object trgObj = target l // if trgObj is null, it is because // the target module is not open. // So open it. if ( null trgObj ) { edit(trgModName, false) trgObj = target l } // if still null, there is a problem. // So skip it. if ( null trgObj ) { linksNotCopied++ continue } // create new link Link newl = toObj->lnkModName->trgObj // copy link attributes string attrName for attrName in lnkMod do { if ( canWrite(lnkMod, attrName) ) { newl.attrName = l.attrName "" } } // delete old link delete l } // scan incoming links for l in fromObj<-"*" do { // get link information Module lnkMod = module l string lnkModName = fullName(lnkMod) string srcModName = source l Object srcObj = source l // if srcObj is null, it is because // the source module is not open. // So open it. if ( null srcObj ) { edit(srcModName, false) srcObj = source l } // if still null, there is a problem. // So skip it. if ( null srcObj ) { linksNotCopied++ continue } // create new link Link newl = toObj<-lnkModName<-srcObj // copy link attributes string attrName for attrName in lnkMod do { if ( canWrite(lnkMod, attrName) ) { newl.attrName = l.attrName "" } } // delete old link delete l } // show errors if ( linksNotCopied > 0 ) { ack linksNotCopied " links were not copied." } // flush out the deleted links flushDeletions() } Skip toDelete = create() Object firstObj = null string objText = "" int cellWdth = 0 bool hasOLE = false int numObjs = 0 Object o for o in current Module do { if ( !isSelected o ) continue // accumlate object texts objText = objText "\n" (richTextWithOle o."Object Text") "" // accumulate cell widths cellWdth += intOf o."TableCellWidth" "" /* // keep OLE if ( oleIsObject(o) ) { // this object has an OLE object if ( hasOLE ) { // already have an OLE object ack "Cannot join two OLE objects." break } hasOLE = true if ( !null firstObj ) { // move OLE to first object oleCut(o) olePaste(firstObj) } } */ if ( null firstObj ) { // record first object firstObj = o } else { // record which objects to delete numObjs++ put(toDelete, numObjs, o) } } if ( null firstObj || numObjs < 1 ) halt // update first object firstObj."Object Text" = richText objText[1:] // cut off leading "\n" if ( cell(firstObj) ) setCellWidth(firstObj, cellWdth) // copy links for o in toDelete do moveLinks(o, firstObj) // delete remaining objects // in reverse order so that children are deleted before parents for i in numObjs:1 by -1 do { if ( find(toDelete, i, o) ) { softDelete(o) flushDeletions() } } | |
![]() |
|
Hi All
Is it possible to merge objects that have In links in them? Edited: 22-Nov-2007 at 11:27 by Jon Martin |
|
![]() |
|
![]() |
|
Hi,
as usual, there is a Kitchen script which does this: "Kitchen -> Objects -> Join seleceted Objects ..." Regards, Peter |
|
![]() |
|
![]() |
|
Peter, I've try the kitchen but it didn't copy the incoming links
I have incoming links from several modules! The script i used is: //join.dxl /* Join selected objects on Object Text. Also move links from deleted objects to joined object. 1. Select a set of contiguous objects. (Only their object text will be retained.) 2. Run this script to replace the object text in the first of these objects with the concatenation of the object texts of the other objects, and then delete those other objects. */ /* Kitchen Tools for customizing DOORS with DXL V7.1 ------------------------------------------------- DISCLAIMER: This programming tool has been thoroughly checked and tested at all stages of its production. Telelogic cannot accept any responsibility for any loss, disruption or damage to your data or your computer system that may occur while using this script. If you do not accept these conditions, do not use this customised script. ------------------------------------------------- */ /* Modifications: Date: Who: Description: 07 Oct 97 jd Creation. 08 Oct 97 wc Changed object text separator to "\n". 15 Oct 97 jd Added copying of links to preserve them. 07 Apr 98 jd Delete objects in reverse order so that children are deleted before parents. 22 Sep 98 jd Preserve rich text. 08 Feb 05 jd Use full paths names for link modules. */ #include <addins/kitchen/utensils/dbs.inc> void moveLinks(Object fromObj, Object toObj) { // move all incoming and outgoing links from // one object to another int linksNotCopied = 0 // scan outgoing links Link l for l in fromObj->"*" do { // get link information Module lnkMod = module l string lnkModName = fullName(lnkMod) string trgModName = target l Object trgObj = target l // if trgObj is null, it is because // the target module is not open. // So open it. if ( null trgObj ) { edit(trgModName, false) trgObj = target l } // if still null, there is a problem. // So skip it. if ( null trgObj ) { linksNotCopied++ continue } // create new link Link newl = toObj->lnkModName->trgObj // copy link attributes string attrName for attrName in lnkMod do { if ( canWrite(lnkMod, attrName) ) { newl.attrName = l.attrName "" } } // delete old link delete l } // scan incoming links for l in fromObj<-"*" do { // get link information Module lnkMod = module l string lnkModName = fullName(lnkMod) string srcModName = source l Object srcObj = source l // if srcObj is null, it is because // the source module is not open. // So open it. if ( null srcObj ) { edit(srcModName, false) srcObj = source l } // if still null, there is a problem. // So skip it. if ( null srcObj ) { linksNotCopied++ continue } // create new link Link newl = toObj<-lnkModName<-srcObj // copy link attributes string attrName for attrName in lnkMod do { if ( canWrite(lnkMod, attrName) ) { newl.attrName = l.attrName "" } } // delete old link delete l } // show errors if ( linksNotCopied > 0 ) { ack linksNotCopied " links were not copied." } // flush out the deleted links flushDeletions() } Skip toDelete = create() Object firstObj = null string objText = "" int cellWdth = 0 bool hasOLE = false int numObjs = 0 Object o for o in current Module do { if ( !isSelected o ) continue // accumlate object texts objText = objText "\n" (richTextWithOle o."Object Text") "" // accumulate cell widths cellWdth += intOf o."TableCellWidth" "" /* // keep OLE if ( oleIsObject(o) ) { // this object has an OLE object if ( hasOLE ) { // already have an OLE object ack "Cannot join two OLE objects." break } hasOLE = true if ( !null firstObj ) { // move OLE to first object oleCut(o) olePaste(firstObj) } } */ if ( null firstObj ) { // record first object firstObj = o } else { // record which objects to delete numObjs++ put(toDelete, numObjs, o) } } if ( null firstObj || numObjs < 1 ) halt // update first object firstObj."Object Text" = richText objText[1:] // cut off leading "\n" if ( cell(firstObj) ) setCellWidth(firstObj, cellWdth) // copy links for o in toDelete do moveLinks(o, firstObj) // delete remaining objects // in reverse order so that children are deleted before parents for i in numObjs:1 by -1 do { if ( find(toDelete, i, o) ) { softDelete(o) flushDeletions() } } |
|
![]() |
|
![]() |
|
Hi,
This script works fine at my place, but keep in mind that links are stored by source. That means you have to edit-open every source of link before launching the merging tool. That can be done manually by following the links before merging, or you can open all linked modules before strating merging objects with: Object o for o in current Module do for mn in o <- "*" do edit fullName of mn Alternately, you can modify the kitchen script, replacing: for l in fromObj<-"*" do { ... with: ModName_ mn for mn in fromObj <- "*" do edit fullName of mn for l in fromObj<-"*" do { ... ------------------------- E. Piallat CeBeNetwork |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Merge / join objects with links
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.