Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Env.: R20, Windows Lang.: Python
@s_bach said in Check object (poly) intersect:
Regarding Volume Interface: if you have problems using the Volume object, please report this in a new thread. There are some issues with the API, that are fixed in the next version.
To formalize it: c4d.modules.volume.VolumeObject.GetVolume() returns a unknown data type and Cinema 4D did crash on me when I tried try to access the value (I think I did something like dir(my_volumeInterface)).
c4d.modules.volume.VolumeObject.GetVolume()
dir(my_volumeInterface)
I always assumed this was somehow intentional/NYI since the Python SDK has no maxon framework and VolumeInterface type (yet), although the Python SDK states that return type of GetVolume() is maxon.VolumeInterface.
maxon
VolumeInterface
GetVolume()
maxon.VolumeInterface
If VolumeInterfaces aren't introduced into the R21 Python SDK, it might be a good idea to flag related methods as NYI.
VolumeInterfaces
Cheers zipit
Hello,
maxon is not a framework, but a module. It is actually available in R20 (just not documented). It can be imported like this:
import maxon
Volume interfaces are part of the volume framework:
from maxon.frameworks import volume as v
With these interfaces it is possible to use the volume classes:
import c4d import maxon from maxon.frameworks import volume as v def main(): # Create VolumeObject volumeObj = c4d.BaseObject(c4d.Ovolume) if volumeObj is None: return # Insert the volume Object within the scene doc.InsertObject(volumeObj, None, None) # Create volume volume = v.VolumeToolsInterface.CreateNewFloat32Volume(0.0) volume.SetGridClass(c4d.GRIDCLASS_FOG) volume.SetGridName("Example Grid") scaleMatrix = maxon.Matrix() volume.SetGridTransform(scaleMatrix) # Create accessor access = v.GridAccessorInterface.Create(maxon.Float32) access.Init(volume) # Set values in the shape of a helix offset = 0.0 scale = 100.0 scaleY = 10.0 while offset < 50.0: res = c4d.utils.SinCos(offset) sin = res[0] cos = res[1] pos = maxon.IntVector32() pos.x = maxon.Int32(sin * scale) pos.y = maxon.Int32(cos * scale) pos.z = maxon.Int32(offset * scaleY) # Set value access.SetValue(pos, 10.0) offset = offset + 0.1 # Insert volume in the VolumeObject volumeObj.SetVolume(volume) c4d.EventAdd() if __name__=='__main__': main()
A volume is then accessed like:
volume = op.GetVolume() print(volume)
Using dir() seems to crash, but this fixed in the next version.
dir()
The upcoming R21 Python documentation will include much more information on the MAXON API and the maxon module.
best wishes, Sebastian
Hi,
thank you for the clarification.