Search found 237 matches

by project4
Sun Jul 29, 2018 6:09 pm
Forum: Assembly
Topic: Another approach to assembly solver (A2plus)
Replies: 1842
Views: 514115

Re: Another approach to assembly solver (A2plus)

Try playing with vector.dot(vector) this what it does def dotproduct(first, other): "dotproduct(Vector,Vector) - returns the dot product of both vectors" if isinstance(first,FreeCAD.Vector) and isinstance(other,FreeCAD.Vector): return (first.x*other.x + first.y*other.y + first.z*other.z) ...
by project4
Sun Jul 29, 2018 2:53 pm
Forum: Assembly
Topic: Another approach to assembly solver (A2plus)
Replies: 1842
Views: 514115

Re: Another approach to assembly solver (A2plus)

Substract spincenter to both v1 and v2, now you have two vectors which are both starting at origin and keep original angle. So now getangle gives you a reliable value. As Kbwbe already said be careful on using methods on spincenter as most of them modify spincenter too @kbwbe, @Turro75 Guys, It loo...
by project4
Sun Jul 29, 2018 9:22 am
Forum: Assembly
Topic: Another approach to assembly solver (A2plus)
Replies: 1842
Views: 514115

Re: Another approach to assembly solver (A2plus)

@kbwbe You will probably have faster answer than I'll get by myself... I have the spinCenter point. I have 2 vectors to 2 refPoints: # Pseuto-code: spinCenter = self.spinCenter v1 = spinCenter.add(dep.refPoint) v2 = spinCenter.add(foreignDep.refPoint) How do I get the angle between the 2 vectors? a...
by project4
Sun Jul 29, 2018 5:58 am
Forum: Assembly
Topic: Another approach to assembly solver (A2plus)
Replies: 1842
Views: 514115

Re: Another approach to assembly solver (A2plus)

@kbwbe You will probably have faster answer than I'll get by myself... I have the spinCenter point. I have 2 vectors to 2 refPoints: # Pseuto-code: spinCenter = self.spinCenter v1 = spinCenter.add(dep.refPoint) v2 = spinCenter.add(foreignDep.refPoint) How do I get the angle between the 2 vectors? an...
by project4
Sun Jul 29, 2018 5:50 am
Forum: Assembly
Topic: Another approach to assembly solver (A2plus)
Replies: 1842
Views: 514115

Re: Another approach to assembly solver (A2plus)

Hmm... You're right about the 1/2 and 0.5 in the multiply. But it's very strange that the constants are not converted to float automatically... The "v2 = v0.add(Base.Vector(2,2,2))" resulted in "v2: Vector (0.0, 0.0, 0.0)" after all. If I change it to (2.0,2.0,2.0) it produces e...
by project4
Sun Jul 29, 2018 5:18 am
Forum: Assembly
Topic: Another approach to assembly solver (A2plus)
Replies: 1842
Views: 514115

Re: Another approach to assembly solver (A2plus)

Now I'm really confused since even that simple code doesn't work :shock: v0 = Base.Vector(0,0,0) v1 = v0.add(Base.Vector(10,10,10)) v2 = v0.add(Base.Vector(2,2,2)) a = v2 a.multiply(1/2) FreeCAD.Console.PrintMessage("v0: {}\n".format(v0)) FreeCAD.Console.PrintMessage("v1: {}\n"....
by project4
Sat Jul 28, 2018 5:49 pm
Forum: Assembly
Topic: Another approach to assembly solver (A2plus)
Replies: 1842
Views: 514115

Re: Another approach to assembly solver (A2plus)

Branch "solver-stabilization" has been updated again. Rigid.calcSpinCenter() is fixed. Also some improvements for project-folder stuff are done. So project folder option is usable for different operation systems. Hi, Didn't have much time this weekend, but I'm playing with the code a bit ...
by project4
Sat Jul 28, 2018 4:55 pm
Forum: Assembly
Topic: Another approach to assembly solver (A2plus)
Replies: 1842
Views: 514115

Re: Another approach to assembly solver (A2plus)

Branch "solver-stabilization" has been updated again. Rigid.calcSpinCenter() is fixed. Also some improvements for project-folder stuff are done. So project folder option is usable for different operation systems. Hi, Didn't have much time this weekend, but I'm playing with the code a bit ...
by project4
Fri Jul 27, 2018 2:36 pm
Forum: Assembly
Topic: Another approach to assembly solver (A2plus)
Replies: 1842
Views: 514115

Re: Another approach to assembly solver (A2plus)

@kbwbe I'm playing with the rotations to see how it works and it looks like the spinCenter calculations doesn't work... What's wrong with that code? def calcSpinCenter(self): newSpinCenter = Base.Vector(0,0,0) countRefPoints = 0 for dep in self.dependencies: if dep.refPoint != None: newSpinCenter.ad...
by project4
Fri Jul 27, 2018 5:30 am
Forum: Assembly
Topic: Another approach to assembly solver (A2plus)
Replies: 1842
Views: 514115

Re: Another approach to assembly solver (A2plus)

Are you sure you saw the duplicates on latest version? I've added the list(set()) to getCandidates in the last change you took from me... Yes. But only 1 duplicate in 1 testcase. It was the motor of the pump. Therefore i could not solve the pump assembly. After my changes, it worked. !? Ohh... I se...