Jump to content

assigning texture to newly created object


Recommended Posts

hey guys,

 

so I'm having some trouble assigning a texture to a 3d polygon thats being created in a PIO... ive got color working using vs.SetFillBack but i can't figure out what to use to apply a texture to the surface... 

 

 

ANWSER:

### Tiles
wide = 5
tall = 6
### Tile PHY Size
ledsize = 24

### Texture Name
ledtext = "Texture-1"

### Build Extrudged Rectangle
vs.BeginXtrd(0, 1)
vs.RectangleN (0, 0, 1, 0, (wide*ledsize), (tall*ledsize) )
vs.EndXtrd()

### Assign Texture to extrude
last = vs.LNewObj()
vs.SetTextureRefN(last, ledtext, 4, 0)

 

Edited by Jayme McColgan
Figured out an anwser
Link to comment

Hi @Jayme McColgan

You can drag a texture from the resource browser onto the 3d polygon or use the rendering tab in the object info palette to assign textures. 

A more powerful way is to assign texture to classes and choose the right class for your object.

 

https://app-help.vectorworks.net/2021/eng/index.htm#t=VW2021_Guide%2FTextures%2FConcept_Applying_textures_by_class.htm&rhsearch=class textures&rhhlterm=class textures&rhsyns=

Link to comment

@Jayme McColgan The script you are looking for is ApplyCustomTexPart.  Texturing through Vectorscript/Python is a bit obtuse, but can be pretty powerful as you can add custom texture parts (so you can texture your 3D poly inside of the PIO separately from the rest of the object, and even give it a unique name such as "video screen").  Basically, you define the parts, then use ApplyCustomTextPart to apply the texture of that part using vs.ApplyCustomTexPart(<handle to PIO>,<handle to destination object>,<part ID #>), then select the Part in the Render tab of the OIP.  I have not been able to successfully get the texture to a place where the Attribute Mapping Tool will allow you to click and drag the texture around, but the standard Scale, Offset H, Offset V, and Rotation fields of the Render tab of the OIP work as expected.

 

I've attached a Vectorscript example that I used to teach myself texturing through script (I use Vectorscript rather than Python, but you should be able to follow along with what the code is doing).  Let me know if you have any trouble installing the plug-in or if you have any questions about it.

Texturing Test.vso

  • Like 1
Link to comment
  • 2 weeks later...

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