For exporting, there is no need to change object type, just call Part::getTopoShape(), which is the work horse behind python Part.getShape(). But then that means I'll have to change upstream exporter code. But what exactly do you want to compare by doing this?
I would like to let both exporters cohabit till the new branch get a full stability with a larger user audience.realthunder wrote: ↑Fri Jun 08, 2018 2:52 pmFor exporting, there is no need to change object type, just call Part::getTopoShape(), which is the work horse behind python Part.getShape(). But then that means I'll have to change upstream exporter code. But what exactly do you want to compare by doing this?
may be we are too involved into FC to keep this at a non emotional level
In that case, I'd suggestion using a macro. I'll modify the script you passed to me tomorrow. BTW, the hang problem is fixed. Any other problem you found?
thx, I'll appreciate it
Just started testing, but it seems many issue have gone
Code: Select all
STEP file can save colors for both edge and face. And this particular STEP file sets both face and edge color with the same value. It is weird when displayed in FC. I'll ignore the edge color in case the shape has face, and the face color is the same as edge color.
Thanks, I'll check later.May be you can get some useful reference here:
https://forum.freecadweb.org/viewtopic. ... 7&start=20
Code: Select all
import FreeCAD, FreeCADGui, Part def copy_obj(parentObj=None,doc=None,subname=''): if not doc: # 'doc' allows you to copy object into another document. # If not give, then use the current document. doc = FreeCAD.ActiveDocument if not parentObj: # If no object is given, then obtain selection from all opened document parentObj =  for sel in FreeCADGui.Selection.getSelectionEx('*'): parentObj.append(sel.Object) if not parentObj: return if isinstance(parentObj,(tuple,list)): if len(parentObj) == 1: copy = copy_obj(parentObj,doc) else: part = doc.addObject('App::Part','Part') for o in parentObj: copy = copy_obj(o,doc) if copy: part.addObject(copy) copy = part if copy: FreeCADGui.SendMsgToActiveView("ViewFit") copy.recompute(True) return copy obj,matrix = parentObj.getSubObject(subname,1,FreeCAD.Matrix(),not subname) if not obj: return # getSubObjects() is the API for getting child of a group. It returns a list # of subnames, and the subname inside may contain more than one levels of # hierarchy. Assembly uses this API to skip hierarchy to PartGroup. subs = obj.getSubObjects() if not subs: # Non group object will return empty subs shape = Part.getShape(obj,transform=False) if shape.isNull(): return shape.transformShape(matrix,False,True) copy = doc.addObject('Part::Feature',obj.Name) copy.Label = obj.Label copy.Shape = shape copy.ViewObject.mapShapeColors(obj.Document) return copy part = doc.addObject('App::Part',obj.Name) part.Label = obj.Label part.Placement = FreeCAD.Placement(matrix) for sub in subs: sobj,parent,childName,_ = obj.resolve(sub) if not sobj: continue copy = copy_obj(obj,doc,sub) if not copy: continue vis = parent.isElementVisible(childName) if vis < 0: copy.Visibility = sobj.Visibility else: copy.Visibility = vis>0 part.addObject(copy) return part
Code: Select all
<asm3.gui> 846.976399 - gui.py(226): command "asm3CmdSolve" exception Traceback (most recent call last): File "/tmp/.mount_FreeCAF9bJ5F/usr/lib/freecad-daily/Ext/freecad/asm3/FCADLogger.py", line 106, in report return func(*args,**kargs) File "/tmp/.mount_FreeCAF9bJ5F/usr/lib/freecad-daily/Ext/freecad/asm3/solver.py", line 348, in solve return _solve(*args,**kargs) File "/tmp/.mount_FreeCAF9bJ5F/usr/lib/freecad-daily/Ext/freecad/asm3/solver.py", line 318, in _solve Solver(assembly,reportFailed,dragPart,recompute,rollback) File "/tmp/.mount_FreeCAF9bJ5F/usr/lib/freecad-daily/Ext/freecad/asm3/solver.py", line 67, in __init__ ret = Constraint.prepare(cstr,self) File "/tmp/.mount_FreeCAF9bJ5F/usr/lib/freecad-daily/Ext/freecad/asm3/constraint.py", line 469, in prepare return mcs.getProxy(obj).prepare(obj,solver) File "/tmp/.mount_FreeCAF9bJ5F/usr/lib/freecad-daily/Ext/freecad/asm3/constraint.py", line 907, in prepare return super(BaseCascade,cls).prepare(obj,solver) File "/tmp/.mount_FreeCAF9bJ5F/usr/lib/freecad-daily/Ext/freecad/asm3/constraint.py", line 895, in prepare h = func(*params,group=solver.group) File "/tmp/.mount_FreeCAF9bJ5F/usr/lib/freecad-daily/Ext/freecad/asm3/system.py", line 233, in addPlaneAlignment d, pln2.origin.entity, pln1.entity.entity, group=group)) AttributeError: 'int' object has no attribute 'entity'
Code: Select all
OS: Ubuntu 18.04 LTS Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.17.5235 (Git shallow) AppImage Build type: None Branch: LinkStage3 Hash: ccaa87e12aaadbd3106607fc503542a863b742da Python version: 2.7.6 Qt version: 4.8.6 Coin version: 4.0.0a OCC version: 7.2.0 Locale: Polish/Poland (pl_PL)
Thanks a lot! it works perfectly!
I see your result ... this is strange...realthunder wrote: ↑Sat Jun 09, 2018 4:52 pmI have trace the code for VBO rendering, at least on Linux, my code has no effect on VBO. That is really a mystery, and I really want to know why it behave like that on your machine. Here is a screencast showing the effect of VBO active and inactive. Rendering transparency disables VBO. The 17fps is about the same for App::Part on my machine.