A2Plus part placement
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: A2Plus part placement
Thanks Syres,
I found the magnifying glass, I thought that was for zooming in (I was expecting the constraints to be highlighted as soon as I selected them, like the rest of FreeCAD).
It is a great program to start for my simple test, but my real project will me much more complicated - it may still be enough, but I'd like more info in writing python macro's. Is there a python FAQ on the web somewhere specifically for FreeCAD?
I found the magnifying glass, I thought that was for zooming in (I was expecting the constraints to be highlighted as soon as I selected them, like the rest of FreeCAD).
It is a great program to start for my simple test, but my real project will me much more complicated - it may still be enough, but I'd like more info in writing python macro's. Is there a python FAQ on the web somewhere specifically for FreeCAD?
Re: A2Plus part placement
Don't worry y'all, I just found the python scripting forum - I'll look through that.
Re: A2Plus part placement
There is the Wiki https://www.freecadweb.org/wiki/Python and the main Macro repository https://github.com/FreeCAD/FreeCAD-macros to have a look through.
Re: A2Plus part placement
Hi All, Me again.
I'm trying to use Klaus' script on my test model. I changed the active element in the code from 'star-wheel_001' to 'disc_001' and centred the #position and #center Base.Vectors, but when I run the code I get the following error:
File "C:/Users/AppData/Roaming/FreeCAD/Macro/simulation - test.py", line 31, in <module>
sw.Placement.Rotation.Angle = math.radians(angle)
<class 'AttributeError'>: 'NoneType' object has no attribute 'Placement'
I had hoped it would be that easy but alas, no.
I'm trying to use Klaus' script on my test model. I changed the active element in the code from 'star-wheel_001' to 'disc_001' and centred the #position and #center Base.Vectors, but when I run the code I get the following error:
File "C:/Users/AppData/Roaming/FreeCAD/Macro/simulation - test.py", line 31, in <module>
sw.Placement.Rotation.Angle = math.radians(angle)
<class 'AttributeError'>: 'NoneType' object has no attribute 'Placement'
I had hoped it would be that easy but alas, no.
- Attachments
-
- simulation - test.py
- (781 Bytes) Downloaded 49 times
-
- test.FCStd
- (13.6 KiB) Downloaded 45 times
Re: A2Plus part placement
you need to use the real object's name within in the makro. "disk_001" is the label, the object name is "b_disc_001_". You can see the real object name within the status line when hovering with the mouse over the object. Using the object name instead of the label should work.
KBWBE
https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
Re: A2Plus part placement
Hey kbwbe, that worked (though I still have errors) - But why are the names different? And how can I make them the same when creating new objects??
Re: A2Plus part placement
Well All, after many attempts I finally got everything placed and all but one constraints fixed. The last constraint I'm having problems with is a pin within a slot. I've tried several types of constraint, but none work.
So now I'm wondering if it's possible to do what I want? What constraints would you use??
So now I'm wondering if it's possible to do what I want? What constraints would you use??
- Attachments
-
- Assembly simulation.py
- (788 Bytes) Downloaded 53 times
-
- Assembly B.FCStd
- (15.51 KiB) Downloaded 62 times
Re: A2Plus part placement
You should use "pointOnPlane" constraint with an offset.Buddy Hy wrote: ↑Tue Sep 24, 2019 9:07 pm Well All, after many attempts I finally got everything placed and all but one constraints fixed. The last constraint I'm having problems with is a pin within a slot. I've tried several types of constraint, but none work.
So now I'm wondering if it's possible to do what I want? What constraints would you use??
- Select a circle of your pin (the center is taken as point)
- Second select a guiding plane within your slot
- Solve the constraint, adjust the offset, so that the pin is in the middle of the slot
KBWBE
https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
Re: A2Plus part placement
Thanks kbwbe, I used that constraint a few times but thought there was something wrong as it moved things around - I didn't realise I had to fudge it.
Anyways, I've got everything constrained now but when I run the macro simulation it goes well for a while then all of a sudden the slide shaft moves to an odd spot - and I'm not even modifying it in the macro. I've attached a screen grab of it happening.
Can anyone tell me what's happening and how to fix it?
Anyways, I've got everything constrained now but when I run the macro simulation it goes well for a while then all of a sudden the slide shaft moves to an odd spot - and I'm not even modifying it in the macro. I've attached a screen grab of it happening.
Can anyone tell me what's happening and how to fix it?
- Attachments
-
- aHuVTXD7YB.gif (836.18 KiB) Viewed 1587 times
Re: A2Plus part placement
I figured out it happens at 92.0º...
Code: Select all
convergency-conter: 151
Calculation stopped, no convergency anymore!
TARGET POS-ACCURACY :0.0001
REACHED POS-ACCURACY :4.009838451613753e-05
TARGET SPIN-ACCURACY :0.0001
REACHED SPIN-ACCURACY :9.71729650378849e-05
SA SPIN-ACCURACY :0.0036838839944608303