Jump to content
Carles Olle

change the size of the bitmap associated to a particular shader record in a texture

Recommended Posts

Hi,

 

I'm trying to change the size of the bitmap associated to a particular shader record in a texture.

I'm not sure how to do that but I assume that I can do it through some code like this:

 

    shaderRecord = vs.GetShaderRecord(texture, 1)
    bitmapHandle = vs.GetTextureBitmap(shaderRecord)
    
    # Get bitmap width and height pixels
    paintWidth = vs.GetObjectVariableLongInt(bitmapHandle, 530)
    paintHeight = vs.GetObjectVariableLongInt(bitmapHandle, 531)
    
    # Set the bitmap feature to max wdith
    vs.SetTexBFeatureStart(bitmapHandle, 0, 0)
    vs.SetTexBFeatureEnd(bitmapHandle, piantWidth, 0)
    
    # Set the width feature to the corresponding real world dimension
    vs.SetTexBitFeatureSize(bitmapHandle, vs.PImage_Width)

    # Set the bitmap feature to max height
    vs.SetTexBFeatureEnd(bitmapHandle, 0, piantHeight)
    
    # Set the width feature to the corresponding real world dimension    
    vs.SetTexBitFeatureSize(bitmapHandle, vs.PImage_Height)

 

The problem is that bitmapHandle doesn't seem to work for most of these calls.

Specifically GetObjectVariableLongInt returns 0 in both cases.

 

I'm sure it is something obvious but I cannot find where is the problem.

Helps would be appreciated.

 

Cheers

--Carlos

 

Share this post


Link to post

It is likely that the PaintWidth and PaintHeight refer to some other object than the Bitmap you have the handle to. Have you tried getting them directly from the Shader instead of the bitmap?

 

I was fighting a similar problem trying to get the record and field of a piece of linked text. Worked great once I found the right object.

 

I will be happy to take a closer look, but please upload a file with the texture/shader already in it and preferably a larger chunk of code so I don't end up solving problems you already have.

Share this post


Link to post

Hi Pat,

 

Thanks for replying.

Yes, I've tried using the shader record but it does not seem to help either.

Please fins attached the files with the source code. It is a tool plug-in so you will need install it and enable it in your workspace.

 

--Carlos

Picture.zip

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.

×