MIBA: Difference between revisions

From FreeCAD Documentation
No edit summary
Line 25: Line 25:
Gui.SendMsgToActiveView(f)
Gui.SendMsgToActiveView(f)
for x,y in [[500,500],[1000,3000],[3000,1000],[3000,3000],[8000,8000]]:
for x,y in [[500,500],[1000,3000],[3000,1000],[3000,3000],[8000,8000]]:
Gui.document().view().saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".jpg",x,y,"White")
Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".jpg",x,y,"White")
Gui.document().view().saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".png",x,y,"Transparent")
Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".png",x,y,"Transparent")


# close document
# close document

Revision as of 08:46, 24 October 2008

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

<python> import Part,PartGui

  1. loading test part

Part.open("C:/Documents and Settings/jriegel/My Documents/Projects/FreeCAD/data/Blade.stp") OutDir = 'c:/temp/'

  1. 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")
  1. close document

App.Close("Unnamed") </python>