Jump to content
twk

Reading Record Info from Other File

Recommended Posts

Greetings,

 

I'm trying to read default record field values from another file using the  BuildResourceListN function:

def vs.BuildResourceListN(type, fullPath):
    return (LONGINT, numItems)

 

I manage to read in the record names from the other file, however using the GetResourceFromList function returns NIL on resource handles. And, as the dev wiki documentation describes, this will return NIL if resource is not in document.

 

Is there another function call I'm missing? or is this not possible. I see that the titleblock tool can open and display issue data from another file. How is it doing this?

@JBenghiat, @Vlado, anyone?

 

Thanks in advance

Share this post


Link to post

If the handle is NIL, you need to import the resource, take what information you need, and then delete it. You only get the handle if the resource is in the current file.

 

The resource manager has the ability to show attached records in other files. I believe this is due to cached data and happened at the core level, so a script can't do something similar. I could be wrong, though.

Share this post


Link to post

Hmm, yes that is what I'm currently doing, importing then deleting. I thought there was a different way. Thanks for the insight.

I'm looking at the build resource list calls, in what use case would the addResoureceToList function call be used for? Is it just a container mechanism for VS? The same functionality can be done using lists in python correct?

Share this post


Link to post

The python API still parallels the VectorScript API, so none of the functions are particularly geared towards python's capabilities. The resource "list" is not related to an actual python list. Behind the scenes, the list is a c++ container, and the LONGINT variable the functions use is essentially a pointer to that container.

 

You can, of course, construct you own functions that output the various Vectorworks calls into python lists. 

  • Like 1

Share this post


Link to post

That is a special index to an internal list created with the build function, and only accessible with the appropriate functions.

 

@Lada can you help with this question?

  • Like 1

Share this post


Link to post

JBenghiat is right. 

There is no way to get a resource from a non-active document.

The only possibility is to import the resource, do what you need and delete the resource.

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