remove the intersection

General discussion about TexGen.

Moderators: Martin, Developers

Post Reply
LijunGu
Regular
Posts: 30
Joined: Mon Jun 01, 2020 4:49 am

remove the intersection

Post by LijunGu »

Hi Dr. Louisepb,

Regarding this topic, i checked the forum very carefully and found there is one discussion quite similar with my question. There is one code in the discussion which the author implemented.

http://texgen.sourceforge.net/phpBB3/vi ... f=1&t=2468#

i tried to create a simple weave to verify the code, unfortunately there is nothing changed after i run the script.

Do you have some ideas?

Don't know why can not upload attachment!

simple weave:
# Script recorded by TexGen v3.12.0
weave = CTextileWeave3D(2, 2, 1, 0.2)
weave.SetYarnWidths(0.8)
weave.AddXLayers(0, 1)
weave.AddXLayers(1, 1)
weave.AddYLayers(0, 1)
weave.AddYLayers(1, 1)
weave.SwapPosition(0, 1, 0, 1)
weave.SwapPosition(1, 0, 0, 1)
weave.SwapPosition(1, 1, 0, 1)
weave.SetYarnHeights(0.1)
weave.SetXYarnWidths(0, 0.8)
weave.SetXYarnHeights(0, 0.15)
weave.SetXYarnSpacings(0, 1)
weave.SetXYarnWidths(1, 0.8)
weave.SetXYarnHeights(1, 0.1)
weave.SetXYarnSpacings(1, 1)
weave.SetYYarnWidths(0, 0.8)
weave.SetYYarnHeights(0, 0.1)
weave.SetYYarnSpacings(0, 1)
weave.SetYYarnWidths(1, 0.8)
weave.SetYYarnHeights(1, 0.1)
weave.SetYYarnSpacings(1, 1)
weave.AssignDefaultDomain(False, False)
textilename = AddTextile(weave)


code which used for modifying intersection:

interferenceCorrection = 0.010
distanceToSurface = FloatVector()
yarnIndices = IntVector()
interferingPoints = CMesh()
numInterferingPoints = weave.DetectInterference(distanceToSurface, yarnIndices, True, interferingPoints)

if numInterferingPoints == 0:
print("No interference detected")
else:
print(str(numInterferingPoints) + " inteference points detected: adjusting layer heights by: "+str(interferenceCorrection)+"...")

layerOffset = XYZ(0,0,0)
for i in range(weave.GetNumYarns()):

# Increment offset after looping through all yarns of one weave (layer)
if (i != 0) and (i % weave.GetNumYarns() == 0):
layerOffset.z += interferenceCorrection

weave.GetYarn(i).Translate(layerOffset)

numInterferingPoints = weave.DetectInterference(distanceToSurface, yarnIndices, True, interferingPoints)
print("After interference correction, " + str(numInterferingPoints) + " interference points remain")



Best regards!
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: remove the intersection

Post by louisepb »

Dear LijunGu,

It looks like you have called the detect interference function but then have offset all yarns by the same interference correction parameter. This will leave you with the same textile but offset by the size of the interference correction parameter in the z direction.

There is a script for adjusting small intersections in meshes on GitHub here: https://github.com/louisepb/TexGenScrip ... ustMesh.py

The adjust interference function will be available via the user interface in the next TexGen release which hopefully won't be too far away.

Hope that helps,
Louise
LijunGu
Regular
Posts: 30
Joined: Mon Jun 01, 2020 4:49 am

Re: remove the intersection

Post by LijunGu »

Hi Dr. Louisepb,

Good news for me.

Yes, I know this code you suggested me five months ago.

I did a simple test for validating this code. Changed the parameter 'Tol' to be 1e-2. First, program showed: Found 16363 intersections between yarns in textile "NewTextile"
Maximum intersection depth to surface 0.148406"; then i tried to run this code and after that program still showed:Found 16363 intersections between yarns in textile "NewTextile" Maximum intersection depth to surface 0.148406"

So the modification of intersection just can be done in the meshing, am i right?
Is ie possible to adjust such big intersection, like 1e-2?

Thank you!
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: remove the intersection

Post by louisepb »

HI LijunGu,

If you use the AdjustSectionMeshes function this will adjust the cross-sections in the model, not just in the meshes. This code was developed to adjust small intersections which would prevent an FE simulation from running. If the intersection is greater than one volume mesh element deep then it won't correct this. The thinking here was that if the intersections were greater then it would be a problem with the model which needs to be addressed.

Hope that helps,
Louise
Post Reply