Jump to content
AlHanson

Get Texture Resource Size

Recommended Posts

I'm attempting to retrieve the size of a texture and the 'Get Texture Size' node seems to fit the bill, but I'm not able to figure out what input the node wants. I've tried the Get Texture node with both the string name and the integer id from this but neither seems to be what the vs.GetTextureSize() command in the node wants. The description and web info for this vectorscipt command are lacking. How do you interact with this node, or if not this node, how can i go about getting the size of a texture resource?

Share this post


Link to post

Get Texture Size wants a handle to a texture as the input. If you have a texture on an object in the drawing already, use Get Texture Reference to specify the object and part of the object that has the texture you want the size of.

 

You could also use Get Texture to show a drop down list of textures in the file to select one to get the size of.

 

HTH.

Share this post


Link to post

Thanks Pat. I'm still confused- what you described is exactly what I was trying and I'm still coming up with a 0 float value on the Texture Size via both the Get Texture Reference and Get Texture nodes. The iTexRef value both nodes provide the index location for the texture (at least I'm assuming that's what this integer value represents?), which presumably should function as the handle here? The texture is currently set for 1" in the resource, so something is not quite right here. I've attached a test file for reference. 

 

154315440_Annotation2020-08-27201458.thumb.jpg.4e640be627a71bf6350dd810955b67b9.jpg

628491849_Annotation2020-08-27202131.thumb.jpg.de6a61e4592d0f53d1c939606f75365b.jpg

TextureScaling.vwx

Share this post


Link to post

I am not really a Marionette or Python specialist. I am just an old time Vectorscript programmer. I am going to wait and see if any of the Marionette gurus will chime in.

 

 

Share this post


Link to post

I stumbled on the solution to this! Seems obvious it hindsight, but I didn't think the Name node would work on items in the Resource Library, only items in the drawing. Using the Name node and referencing the texture resource name will produce the handle you need for the Get Texture Size node to work. This is a bit clunky for scripting (at least as I'm trying to use it) but I made one minor tweak to the Get Texture Size node to pull the handle by name and the whole thing works the way it seems like it should now. I've attached a file with the modified node if it's of any use to anybody else. Enjoy!

 

2116419346_Annotation2020-09-07141602.thumb.jpg.5885c24b1a45a05620cfcc045a157e22.jpg

 

 

 

Get Texture Size v2.vwx

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