Carles Olle Posted November 22, 2018 Share Posted November 22, 2018 (edited) This is a question that probably has a simple answer but that, for some reason I cannot manage to get right. So far I have this code but it does not seem to produce the expected results (the 3D poly-line does not show any texture at all): vs.BeginPoly3D() vs.Add3DPt((-5, 0, -5)) vs.Add3DPt(( 5, 0, -5)) vs.Add3DPt(( 5, 0, 5)) vs.Add3DPt((-5, 0, 5)) vs.Add3DPt((-5, 0, -5)) vs.EndPoly3D() image = vs.LNewObj() textureRef = vs.Name2Index("Test texture") vs.SetObjExpandTexture(image, 0) vs.SetTextureRef(image, textureRef, 1) vs.SetDefaultTexMap(image) vs.SetTexMapBool(image, 3, 3, True) # repeat horizontally vs.SetTexMapBool(image, 3, 4, True) # repeat vertically vs.SetTexMapInt(image, 3, 1, 0) # plane projection vs.SetTexMapReal(image, 3, 1, 0) # offset x vs.SetTexMapReal(image, 3, 2, 0) # offset y vs.SetTexMapReal(image, 3, 3, 10) # scale vs.SetTexMapReal(image, 3, 4, 0) # rotation Why this doesn't work? Any hint will be appreciated. --Carles Edited November 30, 2018 by Carles Olle Quote Link to comment
Gelde-Aart Posted November 27, 2018 Share Posted November 27, 2018 To assign a texture to the 3D object use the vs.SetTextureRefN(obj, textureRef, texPartID, texLayerID), so your script would look like: vs.BeginPoly3D() vs.Add3DPt((-5, 0, -5)) vs.Add3DPt(( 5, 0, -5)) vs.Add3DPt(( 5, 0, 5)) vs.Add3DPt((-5, 0, 5)) vs.Add3DPt((-5, 0, -5)) vs.EndPoly3D() image = vs.LNewObj() textureRef = vs.Name2Index("Test texture") texPartID = 0 texLayerID = 0 vs.SetTextureRefN(image, textureRef, texPartID, texLayerID) In the above the texPartID is the primary and the texLayerID is about the base object (0) or decals(1 and further). 1 Quote Link to comment
Vectorworks, Inc Employee Dave Donley Posted November 27, 2018 Vectorworks, Inc Employee Share Posted November 27, 2018 Thanks spaghetto for helping! I think one detail is that the texture part for 3D polygons should be 3 (for overall texture part). HTH 1 Quote Link to comment
Gelde-Aart Posted November 27, 2018 Share Posted November 27, 2018 Dave your right: 3 is overall, but don't know why it also did work with the 0 as texturePart... Did a quick backwards test with an extrude and it seems that 3 is overall, 0 are the sides, 4 is the Top and 5 is the Bottom of an extrude. Quote Link to comment
Carles Olle Posted November 28, 2018 Author Share Posted November 28, 2018 That's exactly right. Thanks (I have another question but I'll open a new topic) Quote Link to comment
Recommended Posts
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.