Simulated Weld

Show off your FreeCAD projects here!
chrisb
Posts: 14054
Joined: Tue Mar 17, 2015 9:14 am

Re: Simulated Weld

Postby chrisb » Sun Mar 04, 2018 4:25 pm

I had hoped for a moment that a distorted clone of a sphere would save space but in vain: A comparison of file sizes yields:
single sphere: 2830
ellipsoid: 3252
sphere+clone: 4550

And while the BOPCheck succeeds on a sphere it fails again on the distorted clone - which in fact is an ellipsoid.
User avatar
microelly2
Posts: 4197
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Simulated Weld

Postby microelly2 » Sun Mar 04, 2018 6:55 pm

bp_737.png
bp_737.png (42.57 KiB) Viewed 799 times

Code: Select all


import numpy as np
import random
ptsk=[]
d0=9
d1=6
xl=10

for i in range(20):
	if i<>0:
		d=d0*(0.8+random.random()*0.4)
		pts=[FreeCAD.Vector(i*xl,d*np.sin(np.pi*a/6),d*np.cos(np.pi*a/6)) for a in range(12)]
		ptsk += [pts]
	d=d1*(0.9+random.random()*0.2)
	pts=[FreeCAD.Vector(i*xl+xl*(0.5+random.random()*0.1),d*np.sin(np.pi*a/6)+random.random()-0.5,d*np.cos(np.pi*a/6)+random.random()-0.5) for a in range(12)]
	ptsk += [pts]
	d=d1*(0.9+random.random()*0.2)
	pts=[FreeCAD.Vector(i*xl+xl*(0.5+random.random()*0.1),d*np.sin(np.pi*a/6)+random.random()-0.5,d*np.cos(np.pi*a/6)+random.random()-0.5) for a in range(12)]
	ptsk += [pts]

uc=3*20-2
vc=11


def createNurbs(ptsarr,uc=0,vc=0):
	'''create the nurbs representation'''

	nu = FreeCAD.ActiveDocument.addObject("Part::Spline","_N")

	bs=Part.BSplineSurface()
	kv=[1.0/(uc-3+1)*i for i in range(uc-2+1)]
	mv=[4]+[1]*(uc-4+1)+[4]

	ku=[1.0/(vc-3+1)*i for i in range(vc-2+1)]
	mu=[4]+[1]*(vc-4+1)+[4]

	bs.buildFromPolesMultsKnots(ptsarr, mv, mu, kv, ku, False, False ,3,3)
	nu.Shape=bs.toShape()
	return nu


createNurbs(ptsk,uc,vc)

User avatar
NormandC
Posts: 18145
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Simulated Weld

Postby NormandC » Sun Mar 04, 2018 9:50 pm

Just FYI, in commercial CAD software with weld features (at least mid-range ones), a fillet weld is just displayed as following:

FC_simulated_fillet_weld_01.png
FC_simulated_fillet_weld_01.png (21.79 KiB) Viewed 781 times

The fillet feature has a bitmap image mapped to its faces to simulate texture, that you can choose to display on screen or not.

One useful thing is that when creating a weld callout in a drawing view, it extracts welding information from the fillet feature.

I think a macro that would sweep a triangle along a selected edge would be simpler and keep a lower filesize. The trick would be for the triangle sides to always be collinear to the faces attached to the edge. And of course it would not be as pretty as those spheres!
chrisb
Posts: 14054
Joined: Tue Mar 17, 2015 9:14 am

Re: Simulated Weld

Postby chrisb » Sun Mar 04, 2018 10:04 pm

I remember that is the way it is shown in books about welding. Especially the different colour is very helpful.
User avatar
bill
Posts: 354
Joined: Fri Jan 09, 2015 9:25 pm

Re: Simulated Weld

Postby bill » Mon Mar 05, 2018 2:24 pm

microelly2 wrote:
Sun Mar 04, 2018 6:55 pm
by chrisb » Sun Mar 04, 2018 6:04 pm
With a few var.defs. BOOM!
nonukeweld.png
nonukeweld.png (22.41 KiB) Viewed 746 times
Thanks MElly! I did not know you were also a master welder! :lol:
triplus
Posts: 8148
Joined: Mon Dec 12, 2011 4:45 pm

Re: Simulated Weld

Postby triplus » Tue Mar 06, 2018 5:21 pm

Any closer and we would see welding sparks too. ;)
User avatar
microelly2
Posts: 4197
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Simulated Weld

Postby microelly2 » Tue Mar 06, 2018 10:13 pm

triplus wrote:
Tue Mar 06, 2018 5:21 pm
Any closer and we would see welding sparks too. ;)
would be a fun to animate
phpBB [video]
:)
triplus
Posts: 8148
Joined: Mon Dec 12, 2011 4:45 pm

Re: Simulated Weld

Postby triplus » Tue Mar 06, 2018 10:19 pm

I went straight to watching the video. Thanks for using the welding glass filter by default. ;)
User avatar
Kunda1
Posts: 3820
Joined: Thu Jan 05, 2017 9:03 pm

Re: Simulated Weld

Postby Kunda1 » Wed Mar 07, 2018 12:15 am

Next time you need to warn us!! I didn't have my Welding mask on! :evil: :lol:
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
silopolis
Posts: 59
Joined: Thu Oct 20, 2016 10:06 pm

Re: Simulated Weld

Postby silopolis » Fri Mar 09, 2018 3:12 pm

NormandC wrote:
Sun Mar 04, 2018 9:50 pm
I think a macro that would sweep a triangle along a selected edge would be simpler and keep a lower filesize. The trick would be for the triangle sides to always be collinear to the faces attached to the edge. And of course it would not be as pretty as those spheres!
How would that work for "external" edge welds?
Feeling like spheres have the advantage of working in all flat, interior and exterior cases, aren't they?

But thinking about penetration too sweeping a circle, partly dipped in welded parts, could be another approximation option... WDYT?