Animated 3D models of Steam Engines

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
atmaja
Posts: 7
Joined: Tue Feb 04, 2020 3:34 am

Re: Animated 3D models of Steam Engines

Post by atmaja »

Thanks brother,,
User avatar
dferbas
Posts: 4
Joined: Tue Feb 09, 2021 4:10 am

Re: Animated 3D models of Steam Engines

Post by dferbas »

Hi,
I am trying to animate exploded assembly of box parts with 2 pbs inside (both imported from a step model, made by Altium). I started with Exploded Assembly WB, you can see video https://www.solarmonitor.cz/download/pu ... -LU/video/. Now I am trying to animate pcb exchange with the Animation WB. I have an issue when I want to put 2 Placers in a Manager and both Placers are using Pathers to move along a BezCurve, Speeder is used for a bakward move. When I trie to do this an error occure and object Pather is moved out from the Manager:

Code: Select all

Exception (Wed Feb 10 20:29:41 2021): Object can only be in a single Group  
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Object can only be in a single Group
Then a tedious job follows - remove link from Speeder to Pather, remove link from Placer.src to the same Pather, move Pather back to Manager and setup links again. Any idea?
2nd question is - what is a proper way tp configure Styler, to change box transparency at the beginning of animation? MTB
User avatar
dferbas
Posts: 4
Joined: Tue Feb 09, 2021 4:10 am

Re: Animated 3D models of Steam Engines

Post by dferbas »

I found a workaround - objects an be manipulated in the tree, while they have no links between them. Solution for now is to remove links, manipulate objects, e.g. remove and add to containers and then recreate links.

Sorry for c&p at end of code, I needed a fast workaround.

Code: Select all

doc = App.ActiveDocument
cam = doc.getObjectsByLabel("My_Photographer GPRS")[0]
cam.fn = "C:/workspace/Altium/modules/SM3-PG/rev A/Released/MBAExportSTEP/video_GPRS"
cam.camDirection = u"View"

def remove_objects(name_speeder, name_placer, name_pather, name_mgr):
	speeder = doc.getObjectsByLabel(name_speeder)[0]
	placer = doc.getObjectsByLabel(name_placer)[0]
	pather = doc.getObjectsByLabel(name_pather)[0]
	mgr = doc.getObjectsByLabel(name_mgr)[0]
	
	speeder.target = None
	placer.src = None
	mgr.removeObject(placer)
	mgr.removeObject(pather)
	mgr.removeObject(speeder)

def add_objects(name_speeder, name_placer, name_pather, name_mgr):
	speeder = doc.getObjectsByLabel(name_speeder)[0]
	placer = doc.getObjectsByLabel(name_placer)[0]
	pather = doc.getObjectsByLabel(name_pather)[0]
	mgr = doc.getObjectsByLabel(name_mgr)[0]
	
	mgr.addObject(speeder)
	mgr.addObject(pather)
	mgr.addObject(placer)
	
def order_objects(name_speeder, name_placer, name_pather, name_mgr):
	speeder = doc.getObjectsByLabel(name_speeder)[0]
	placer = doc.getObjectsByLabel(name_placer)[0]
	pather = doc.getObjectsByLabel(name_pather)[0]
	mgr = doc.getObjectsByLabel(name_mgr)[0]
	
	speeder.target = pather
	placer.src = pather

remove_objects("My_Speeder", "My_Placer_GPRS", "My_Pather", "My_Manager_GPRS")
#remove_objects("My_Speeder001", "My_Placer_NB-IoT", "My_Pather001", "My_Manager_NB-IoT")
remove_objects("My_Speeder001", "My_Placer_NB-IoT", "My_Pather001", "My_Manager_GPRS")

add_objects("My_Speeder", "My_Placer_GPRS", "My_Pather", "My_Manager_GPRS")
add_objects("My_Speeder001", "My_Placer_NB-IoT", "My_Pather001", "My_Manager_GPRS")

order_objects("My_Speeder", "My_Placer_GPRS", "My_Pather", "My_Manager_GPRS")
order_objects("My_Speeder001", "My_Placer_NB-IoT", "My_Pather001", "My_Manager_GPRS")
Post Reply