Simulated Weld

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Simulated Weld

Post by chrisb »

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.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Simulated Weld

Post by microelly2 »

bp_737.png
bp_737.png (42.57 KiB) Viewed 2696 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
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Simulated Weld

Post by NormandC »

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 2678 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
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Simulated Weld

Post by chrisb »

I remember that is the way it is shown in books about welding. Especially the different colour is very helpful.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
bill
Posts: 376
Joined: Fri Jan 09, 2015 9:25 pm

Re: Simulated Weld

Post by bill »

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 2643 times
Thanks MElly! I did not know you were also a master welder! :lol:
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Simulated Weld

Post by triplus »

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

Re: Simulated Weld

Post by microelly2 »

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
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Simulated Weld

Post by triplus »

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

Re: Simulated Weld

Post by Kunda1 »

Next time you need to warn us!! I didn't have my Welding mask on! :evil: :lol:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
silopolis
Posts: 74
Joined: Thu Oct 20, 2016 10:06 pm

Re: Simulated Weld

Post by silopolis »

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?
Post Reply