Jump to content

AssociateLinearDimension() does not work. (For me)


Sam Jones

Recommended Posts

Why does the script below not associate the created dimensions with the selected symbols and PIOs

(line 33)

The dimension are created and seem to be correct, but when I select a dimensioned object and move it, the associated dimension does not move with it

I have attached a file that contains the script, "Dimension Test", and selected Lighting Devices to dimension.

 

{Line 1}   PROCEDURE AssociateDims;

TYPE
    AnObject = STRUCTURE
        ObjHdl    :HANDLE;
        X            :REAL;
        Y            :REAL;
    END; {AnObject}
    
VAR
    ObjArray            :ARRAY[1..10] OF AnObject;
    Obj                :HANDLE;
    ObjCount            :INTEGER;
    Index                :INTEGER;
    
BEGIN
    ObjCount := 0;
    Obj := FSActLayer;
    WHILE Obj <> NIL DO                    {Fill ObjArray with selected objects}
        BEGIN
            IF ((GetType(Obj) = 15) | (GetType(Obj) = 86)) THEN
                BEGIN
                    ObjCount := ObjCount + 1;
                    ObjArray[ObjCount].ObjHdl := Obj;
                    GetSymLoc(Obj, ObjArray[ObjCount].X, ObjArray[ObjCount].Y)
                END; {IF ((GetType(Obj) = 15) |}
            Obj := NextSObj(Obj);
        END; {WHILE Obj <> NIL}
    
    FOR Index := 1 TO ObjCount DO    {Place Dimension from X=0 to Object X}
        BEGIN
            LinearDim(0, ObjArray[Index].Y, ObjArray[Index].X, ObjArray[Index].Y, 24, 0, 770, 514, 1);
{line 33} AssociateLinearDimension(LNewObj, FALSE);
        END;
END;
RUN(AssociateDims);

 

 

 

Associate Dimension Test 2021.vwx

Link to comment

Hey Sam,

   Like you, it did not at first make sense to me either, but with a little experimentation it appears both ends of the dimension need to be on the object for the association to stick. I am surprised there is not a similar call that requires 2 handles to specify the object AND the dimension. Oh well, c'est la vie. 

 

   I've never used this, but have you played with AddAssociation()? The documentation is no worse than that of AssociateLinearDimension().

 

Raymond

Link to comment

 

16 hours ago, MullinRJ said:

but have you played with AddAssociation()?

 

I have played with AddAssociation with the kOnDeleteDelete and kOnDeleteReset flags in several other commands.  There don't seem to be any other flags that I can find, although I'm sure there are some.  I doubt that there is a flag that would replace  AssociateLinearDimension() routine.

 

The most frustrating thing is that I got AssociateLinearDimension(LNewObj, FALSE); to work 10 days ago.  I have both recreated and retrieved from Time Machine the code from then, and still nothing works.  The example I sent dimensions the selected symbols and PIOs from center, adding an association to each.  Why doen't it work.  I guess I'll submit a bug, but I did get it to work once upon a time.

Edited by Sam Jones
add clarifying phrase
Link to comment

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