Hi @Telerak, first of all, welcome in the plugincafe community.
Just a little request for your next topics, please mark your topic as a question see , I've done it this time, no worry at all.
You can find an example of the step file import bellow.
"""
Copyright: MAXON Computer GmbH
Author: Maxime Adam
Description:
- Import STP/STEP with custom settings.
Class/method highlighted:
- c4d.plugins.FindPlugin()
- MSG_RETRIEVEPRIVATEDATA
- c4d.documents.MergeDocument()
Documentation:
- https://developers.maxon.net/docs/Cinema4DPythonSDK/html/consts/FORMAT_export.html
- https://developers.maxon.net/docs/Cinema4DCPPSDK/html/_fcadimport_8h.html
Compatible:
- Win / Mac
- R20
"""
import c4d
def main():
# Retrieves a path to load the imported file
selectedFile = c4d.storage.LoadDialog(title="Load File for STEP Import", type=c4d.FILESELECTTYPE_ANYTHING, force_suffix="step")
if not selectedFile:
return
# Retrieves STEP import plugin
plug = c4d.plugins.FindPlugin(c4d.FORMAT_STEPIMPORT, c4d.PLUGINTYPE_SCENELOADER)
if plug is None:
raise RuntimeError("Failed to retrieves the STEP importer.")
data = dict()
# Sends MSG_RETRIEVEPRIVATEDATA to OBJ import plugin
if not plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, data):
raise RuntimeError("Failed to retrieves private data.")
# BaseList2D object stored in "imexporter" key hold the settings
stepImport = data.get("imexporter", None)
if stepImport is None:
raise RuntimeError("Failed to retrieves BaseContainer private data.")
# Defines the settings
stepImport[c4d.CADIMPORT_SPLINES] = False
stepImport[c4d.CADIMPORT_ORIGINAL_UNITS] = False
# Sets the data by Scaling 10x and set to mm units
scale = c4d.UnitScaleData()
scale.SetUnitScale(10, c4d.DOCUMENT_UNIT_vMM)
stepImport[c4d.CADIMPORT_SCALE] = scale
# Finally imports without dialogs
if not c4d.documents.MergeDocument(doc, selectedFile, c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS, None):
raise RuntimeError("Failed to load the document.")
c4d.EventAdd()
if __name__ == '__main__':
main()
Finally, you can find symbols for importer/exporter in FORMAT EXPORT page. Unfortunately, for options you have to search the C++ documentation, here the ones for STEP file Fstepimport.h as you can see it is not that much here, but if you take a look at the res files (Cinema 4D R20\resource\modules\cadexchange\description\Fstepimport.res) it also include Fcadimport resource so, that means you can also define the value from Fcadimport.h
I know the documentation get room to be improved on this topic. I will see what's possible to do.
Cheers,
Maxime.