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 1 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! 1 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. 1 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!!! 1 Quote Link to comment
BillW Posted August 11 Share Posted August 11 Finally got to grips with the problem of fully implementing textures for extrude along path plugins (at least I think). Seems to handle all texture options ie None, by Class and Texture. With multi path set, you can make a selection of both path1 and path2 texture parts and edit Mapping for both at the same time. Similarly, you can set a common texture for both. Find enclosed VW2024 plugin "Path Tool VWX FORUM" based on sandertb's version above. Added a multi path option as a proof of concept - see image below Any further information will be gratefully received. Thanks Path Tool VWX FORUM.vso 2 Quote Link to comment
sandertb Posted August 12 Author Share Posted August 12 @BillW This is awesome, thanks for sharing! 1 Quote Link to comment
BillW Posted August 12 Share Posted August 12 Thanks - it was a good exercise. The only thing I'm worried about is a conflict with another plugin using a texture part ID with the same number ie texPartID = 100 #custom partID I am assuming the texture part ID is global. Does anyone know how to find out if a texture part ID is already defined. 1 Quote Link to comment
Pat Stanford Posted August 12 Share Posted August 12 I agree that texPartID appears to be global. And I could not find any method of determining if the ID is already in use. 😞 1 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.