Jump to content
Jesse Cogswell

Going into a Symbol's 2D Edit with Script

Recommended Posts

Good morning,

 

I am working on a PIO that can use a symbol as base geometry so that users can have further customization.  Is there a way to make the double-click behavior of the PIO edit the reference symbol?  I've added all of the requisite commands for the double-click special edit and to pull the handle of the referenced symbol definition, but can't find a command to open up the symbol editor for the symbol definition.  I tried EditObjectSpecial(symDefHand,4), but it keeps thinking I'm trying to edit the PIO instead.  If I change the editMode to 2 (Properties), it opens up the properties pane for the PIO, not the referenced symbol.

 

I did a few tests by playing around with the EditObjectSpecial procedure inside some temp scripts.  It worked perfectly for editing symbols but only if I had a symbol selected before running, and even then it would edit the selected symbol rather than the symbol definition passed into EditObjectSpecial.  If nothing is selected, the script doesn't do anything.  I can even pass in an empty handle as long as something is selected before running the script.  I've tried it in 2018, 2019, and 2020 with the same results.  Do we think that this is a bug or am I misreading its need for a passed handle?

 

For those playing along at home, my test script is as follows:

Quote

PROCEDURE EditSymbol;

    VAR

        i:INTEGER;
        resList,numSymbols:LONGINT;
        symbolName:STRING;
        symbolHand,testHand:HANDLE;

    BEGIN
        symbolName:='Test Symbol 1';

        resList:=BuildResourceList(16,0,'',numSymbols);
                
        FOR i:=1 TO numSymbols DO
            BEGIN
                testHand:=GetResourceFromList(resList,i);
                IF(GetName(testHand)=symbolName) THEN symbolHand:=testHand;
            END;

        Message(GetName(symbolHand));
        EditObjectSpecial(symbolHand,4);
    END;
    
Run(EditSymbol);

 

I'm also down for trying something different to get to the symbol editor if anyone has any ideas.

 

- Jesse

Share this post


Link to post

The following will edit the symbol at the conclusion of the script:

 

SetObjectVariableInt(SymDefHandle, 9743, 0);
 

You can also get a handle to a symbol definition simply with GetObject() instead of using the resource list. 

 

  • Like 1

Share this post


Link to post

Hi Josh,

   In all the documentation I've got (limited as it may be), I've never seen an ObjVar in the 9000 range. Is there anything online with that info, or do tap into guru's in the factory?

 

TIA,

Raymond

Share this post


Link to post

@Raymond All the object variables >9000 I've learned from private discussions or posts to the list (and I think all from the listserv days). 

Share this post


Link to post

Thanks, Josh. I do miss those days and the mailing lists.

 

Raymond

Share this post


Link to post

@JBenghiat Thank you for this, it certainly did the trick!  The resource list was used in the larger code to populate a list box for selection and I didn't think to remove it when I scaled it down to test EditObjectSpecial.

Share this post


Link to post

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.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...