sandertb Posted August 18, 2023 Share Posted August 18, 2023 Hey everyone, I am currently building a tool that creates an Extrude along a path and attaches a texture to this. However, on some sides of the extrude the texture is rotated 90 degrees, while on others it has the correct rotation. def create3DLine(objectHand, path): vs.RectangleN( 0,0,1,0, 1, params().bambooHeight) profile = vs.LNewObj() offsetPath = vs.OffsetPolyN(vs.CreateDuplicateObjN(path, objectHand, True), offset3D, False) vs.SetPlanarRefIDToGround(offsetPath) offsetNurbs = vs.ConvertToNURBS(offsetPath, False) extrude = vs.ExtrudeAlongPath(offsetNurbs, profile) vs.DelObject(profile) texPartID = 3 texLayerID = 0 texture = vs.Name2Index("Bamboo Prop Texture") vs.SetTextureRefN(extrude, texture , texPartID, texLayerID) Does anybody know how to fix this? Quote Link to comment
Marionette Maven Marissa Farrell Posted August 18, 2023 Marionette Maven Share Posted August 18, 2023 @sandertb Can you attach the file you're working with? Quote Link to comment
sandertb Posted August 21, 2023 Author Share Posted August 21, 2023 @Marissa Farrell I have minimalized my code so that it only contains the import parts for this issue, and it's attached below. Thanks for helping out! vwx_forum_bamboo.vwx Bamboo Tool VWX FORUM.vso Quote Link to comment
Marionette Maven Marissa Farrell Posted August 22, 2023 Marionette Maven Share Posted August 22, 2023 @sandertb A few things while I'm still in process of finding a solution. When you ungroup your object (in a 3D view), you can see that you still have your NURBS profile, which I think you made effort to delete in your code, so may be worth looking into. Also, it appears that your texture is being set as Surface UV mapping, if you can get this to always draw with Auto-Align Plane, then I think it would solve your issue. I'm playing with SetTexMapBoolN to try to resolve this as it works with an EAP object not inside of a PIO, but maybe am referencing the wrong object when placing it in your code so far. The only thing I worry about is I can't get the texture to redraw on the object even while using ResetObject and ReDrawAll, so that's something to also be mindful of. I'm going to submit a bug about that and see where it goes, but for now I think the focus is setting the texture mapping appropriately on your object. Quote Link to comment
MullinRJ Posted August 22, 2023 Share Posted August 22, 2023 @Marissa Farrell, This is a shot in the dark. Try ResetBBox(). I've had luck with it in the past when RedrawAll didn't work. No guarantees, just a suggestion. Raymond Quote Link to comment
Marionette Maven Marissa Farrell Posted August 22, 2023 Marionette Maven Share Posted August 22, 2023 @MullinRJ That worked! Fascinating. I'll have to keep that in mind moving forward, thanks! Quote Link to comment
Marionette Maven Marissa Farrell Posted August 22, 2023 Marionette Maven Share Posted August 22, 2023 @sandertb I think I got it. Throw vs.SetTexMapIntN(extrude, texPartID, texLayerID, 1, 0) in after your assigning of texture. That's been working pretty consistently for me and doesn't appear to need the ResetBBox command. Quote Link to comment
sandertb Posted August 23, 2023 Author Share Posted August 23, 2023 @Marissa Farrell Thank you so much, this works like a charm!!! 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.