It's all about the answers!

Ask a question

Do you have a DOORS DXL script that can move objects to other locations within the same module if the location is spectified in the object attribute?


Greg Winter (11) | asked Jan 09, 8:56 p.m.
Greetings,

Does anyone have a DOORS dxl script that can automatically loop through a large group of newly imported objects (located at the bottom of a DOORS module) and move each object to another location in the module that is specified in an attribute of that object?

Greg

One answer



permanent link
stuart green (661) | answered Jan 11, 6:44 a.m.

Hi Greg,

You could use something like this. New objects are deemed to be those with a non-null value in the attribute containing the target object. So to avoid unwanted moving, objects which exist before the import will need to have it set to null before running.

// If an object has a value in the attribute specified in "targetAttrName" it will
// be moved to the Object whos Absolute Number corresponds to that value

// Exact target location can be changed by altering "move(o, targetObj)"
// Current move behaviour makes moved objects the last child of the specified target

Module m = current
Object o, targetObj

int targetObjAbsNo
string targetAttrName = "trg"

for o in entire m do {

    targetObjAbsNo = null
    targetObjAbsNo = o.targetAttrName

    if (!null targetObjAbsNo) {

        targetObj = object (targetObjAbsNo, m)
        move(o, targetObj)

        o.targetAttrName = null
    }
}
Regards,
Stuart.


Comments
Greg Winter commented Jan 12, 10:23 p.m.

 Thanks Stuart, for the response. I will check this out.


-Greg

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.