Jump to content

create and insert folder into preexisting folder.


Recommended Posts

i have a script that makes a folder and imports some symbols in it... id like to take that freshly made folder and its symbols and put them in another already existing folder (for organizing sake). anyone done anything like this? vs.InsertSymbolInFolder() doesn't seem to work for folders

 

Side question:

is it possible to get the handles or names of everything inside a symbol folder in the current drawing? 

Edited by Jayme McColgan
stupid typos...
Link to comment
  • Jayme McColgan changed the title to create and insert folder into preexisting folder.

For question 2, the answer is to look at Build Resource List. You can specify to only look in the current docuement and I think you can even specify a Symbol Folder.

 

For question 1, I don't know for sure, but if you can get a handle to both the folder you want to move and the folder you want to move it into I would try SetParent.

Link to comment

I would bet someone has a way to do this. Based on my old archives, moving symbols folders is a big no-no in VW, but now the RM lets us do it graphically fairly easily.

 

I can't even find a way to make a symbol folder at less than the root level of the Resource Manager. I was going to suggest create a new folder, move all the symbols from the old folder to the new one and then delete the original.  InsertSymbolInFolder.

Link to comment

What you need to do is make the new folder in its final destination by specifying that path when you call the CreateFolder() function, then move the newly created symbols into that folder by specifying its path.  I do this with 7 different routines.  If you specify a path and folder that already exists, no new folder is created, and the newly created symbols are placed in the existing folder.

Link to comment


Assuming am array of handles to the newly created symbols can be created (it can), create the folder and insert the symbols into it.
The code below, is cut/pasted from a working command.  It inserts imported symbols whose handles are in an array.  An array of handles to the new symbols can be created as the symbols are created.  (This all assumes that I understand what is being asked.  Maybe not)


                dlogSymFolder := GetObject('Dlog Symbol Folder');                  {Get a handle to the folder named 'Dlog Symbol Folder' }
                IF dlogSymFolder = NIL THEN                                                      {if the folder does not exist (handle is nil) create it and get a handle to it}
                    BEGIN
                        NameObject('Dlog Symbol Folder');
                        BeginFolder;
                        EndFolder;
                        dlogSymFolder := GetObject('Dlog Symbol Folder');
                    END; {IF dlogSymFolder = NIL}
                FOR index := 1 TO numImported DO                                              {Insert each symbol (by handle) into the new or existing folder}
                    InsertSymbolInFolder(dlogSymFolder,importHandles[Index]);

 

Link to comment

Nope.

Oh well.   ....

Perhaps you could create the folder you want where you want with a

 

NameObject('NameOne');

BeginFolder;

     NameObject('NameTwo');

     BeginFolder;

     EndFolder;

EndFolder;

 

I don't know how long a shot that is.  Changing names mid folder creation seams dicey, but if the need is great, try it out.

Link to comment
1 hour ago, Sam Jones said:

Nope.

Oh well.   ....

Perhaps you could create the folder you want where you want with a

 

NameObject('NameOne');

BeginFolder;

     NameObject('NameTwo');

     BeginFolder;

     EndFolder;

EndFolder;

 

I don't know how long a shot that is.  Changing names mid folder creation seams dicey, but if the need is great, try it out.

hey sam, yes this way works but ONLY if you're creating all the folders you need at one time. i cant do that... this folder will have several folders in it as various plugins are ran and need to import/create symbols. 

 

a long winded way that i havent tried yet seems like was talked about above is to get all the items in the main folder, give that a temp name, make a new folder with the correct folder in that and then use InsertSymbolInFolder() to move everything and delete the old folder... id ranter not do this as it sounds like theres A LOT of room for error and no one like high margin of errors... lol i will check back in if i come up with anything. 

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