MIBA: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
Line 15: Line 15:
== Making Miba pictures by script == <!--T:5-->
== Making Miba pictures by script == <!--T:5-->
</translate>
</translate>
<syntaxhighlight>
<syntaxhighlight lang="python">


import Part,PartGui
import Part,PartGui

Revision as of 18:31, 21 August 2021

Introduction

Miba is a way to embed information about the 3D space into a 2D image. This makes it often possible to use the 2D picture instead of a 3D viewer. By the Miba information you're able to calculate the position of a 3D location in the 2D image. That allows you to decorate the image later with arbitrary 3D information. You can take the picture in an early state (design) and use it later (e.g. Production). You do not need to know the kind of 3D data or the positions when you take the picture. So the picture is completely separated from the 3D data.

A detailed specification you can find here: http://miba.juergen-riegel.net/

Miba in FreeCAD

If you choose a file format which has an comment ability ( JPG and PNG) you can choose to write a comment or insert the MIBA information in the comment fileds (default):

Making Miba pictures by script

 import Part,PartGui
 # loading test part
 Part.open("C:/Documents and Settings/jriegel/My Documents/Projects/FreeCAD/data/Blade.stp")
 OutDir = 'c:/temp/'
 Gui.ActiveDocument.ActiveView.setAnimationEnabled(False)
 
 # creating images with different Views, Cameras and sizes
 for p in ["PerspectiveCamera","OrthographicCamera"]:
   Gui.SendMsgToActiveView(p)
   for f in ["ViewAxo","ViewFront","ViewTop"]:
     Gui.SendMsgToActiveView(f)
     for x,y in [[500,500],[1000,3000],[3000,1000],[3000,3000],[8000,8000]]:
       Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".jpg",x,y,"White")
       Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".png",x,y,"Transparent")
 
 # close active document
 App.closeDocument(App.ActiveDocument.Name)