Using refine option in custom python scripted model

General discussion about TexGen.

Moderators: Martin, Developers

Post Reply
vptudd
Posts: 4
Joined: Thu Feb 02, 2017 3:20 pm

Using refine option in custom python scripted model

Post by vptudd »

Hello,
I´m quite new to both TexGen and Python-scripting, so I have a question:
Is it possible to use the "refine" option in a self created python script?
Meaning that I created a model using python and am now trying to get rid of the intersections, which could in my understanding be done quite simply by using the refine option as it is avalaible for the pre-defined 2D/3D-weaves.
I´d be quite thankful for a response.
Regards,
Valentin

PS. I´m sorry if this is already explained somewhere, but I looked for it and didn´t find it.
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Using refine option in custom python scripted model

Post by louisepb »

Hi Valentin,

If you create the textile using the CTextileWeave2D class then you can call the refine function at a later point using the RefineTextile function as shown here http://texgen.sourceforge.net/api/class ... 3d6e363b0e
The refinement is not available if you have used the CTextile base class and specified all the yarns yourself as, in this case, there is no information about the weave pattern available.
For small intersections you should be able to use the CAdjustMeshInterference class http://texgen.sourceforge.net/api/class ... rence.html

I hope that helps,
Louise
vptudd
Posts: 4
Joined: Thu Feb 02, 2017 3:20 pm

Re: Using refine option in custom python scripted model

Post by vptudd »

Hi Louise,
thanks for the answer. Is there any tutorial or explanation on how to use CAdjustMeshInterference? As I said, I´m quite new to scripting.
Could you maybe give an example on how to use the "AdjustMesh"-function?
I wold be very thankful for any kind of help.
Best wishes,
Valentin
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Using refine option in custom python scripted model

Post by louisepb »

Hi Valentin,
Apologies for the slow reply, I've been on holiday for a couple of weeks.
You can find a sample script which shows how to use the AdjustMesh function here: https://github.com/louisepb/TexGenScripts

The algorithm used works better in some cases than others so you'll have to experiment to see if it helps. It will make changes to your model so make sure that you've saved your original model first!

Hope that helps,
Louise
Post Reply