Jump to content
Developer Wiki and Function Reference Links Read more... ×
Justin Smith

SetTextureBitmap

Recommended Posts

Any one have any luck with this function?

def vs.SetTextureBitmap(shaderRecord, textureBitmap):

return None

I'm trying to pass a bitmap image (ObjectId 14) into the function. Doesn't seem to be working. Do I need to be using a bitmap texture?

What I'm trying to do is take a Bitmap Image object and make it into a texture with an image shader. I make the texture fine, I can add the shader record. Just can't seem to add a bitmap to the texture. Specifically want to add a bitmap that is already in the document but not setup as a render works texture.

Share this post


Link to post

So it definitely appears that I need to be using a bitmap texture with vs.SetTextureBitmap(shaderRecord, textureBitmap):

What I need to figure out is if its possible to go from a bitmap image to a bitmap texture. Some of the paintnode Functions perhaps?

Share this post


Link to post

Anyone know how CreatePaintFromImage or CreatePaintFromImgN are supposed to work?

I've tried passing both an image (14) and a TextureDefinitionMaterial (97) and get back a nil obj.

I'm also not exactly sure what a "paint node" is.

"Return Value

Returns the handle to the newly created paint node."

My hope was that it would take a bitmap image and convert it to a texture bitmap.

Share this post


Link to post

Still would love some insight here. The workflow I'm trying to accomplish is loading up images from disk automatically (based on a worksheet) and then creating a renderworks texture out of them.

So far I can only figure out how to import the images as an image and can't convert them to a textureBitmap.

Here's code (partially taken from a VW sample plugin). How or what could I do to instead of insert a image below insert a bitmapTexture?

def getImageForFileName(fileName, err, dirPath):

#uses FSActLayer so I think I need to deselect

vs.DSelectAll()

major, minor, maintenance, platform = vs.GetVersion()

isMac = False

if platform == 1: isMac = True

# define a location to import the images

importPt = (0,0)

if err == 0: # no-error

hsfDirPath = dirPath

if isMac: ok, hsfDirPath = vs.ConvertPosix2HSFPath( dirPath )

fileIndex = 1

fileName += ".png"

name, ext = os.path.splitext( fileName )

if ext.lower() == '.png':

imagePath = os.path.join( dirPath, fileName )

vs.ImportImageFile( imagePath, importPt )

hImage = vs.FSActLayer()

if hImage == 0:

vs.AlrtDialog("No image with name '", fileName, "' in directory " , dirPath)

return hImage

Edited by Justin Smith

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

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.

×