Considering this thread it looks like getting points selection order is not trivial task for c4d api.
Latest posts made by Gaal Dornik
-
RE: How to weld two points to the last selected point?
-
RE: GetActiveToolData() doesn't work for Mirror Tool
I want to mirror a polygon selection along specified modeling axis, but i'm kinda stuck since i can't apply the dedicated Mirror Tool, the basic Scale Tool also doesn't allow to set the tool settings...
-
RE: How to weld two points to the last selected point?
The problem with this code - it doesn't always work correctly. Sometimes it's not taking into account selection order - welds to the first selected point for example. Look at this preview.
import c4d def main(): doc = c4d.documents.GetActiveDocument() op = doc.GetActiveObject() lastPoint = op.GetPointS().GetLastElement() settings = c4d.BaseContainer() settings[c4d.MDATA_WELD_TOPOINT] = True settings[c4d.MDATA_WELD_POINTINDEX] = lastPoint settings[c4d.MDATA_WELD_OBJECTINDEX] = op doc.StartUndo() doc.AddUndo(c4d.UNDOTYPE_CHANGE, op) result = c4d.utils.SendModelingCommand( command=c4d.ID_MODELING_WELD_TOOL, list=[op], mode=c4d.MODELINGCOMMANDMODE_POINTSELECTION, bc=settings, doc=doc,) doc.EndUndo() c4d.EventAdd() if __name__=='__main__': main()
-
RE: Howto add headers & dividers for a ShowPopupDialog?
It works as expected in C4D 2024, but not in the previous versions.
-
How to weld two points to the last selected point?
Hello, currently this code welds two points in the middle, but i want it to weld to the last selected point, setting MDATA_WELD_TOPOINT to True doesn't help. How to solve this?
import c4d, sys # # M A I N # def main(): doc = c4d.documents.GetActiveDocument() settings = c4d.BaseContainer() settings[c4d.MDATA_WELD_TOPOINT] = True result = c4d.utils.SendModelingCommand( command=c4d.ID_MODELING_WELD_TOOL, list=[op], mode=c4d.MODELINGCOMMANDMODE_POINTSELECTION, bc=settings, doc=doc, flags=c4d.MODELINGCOMMANDFLAGS_CREATEUNDO) if not result: raise RuntimeError(f"Modelling command failed for {op}.") # Inform Cinema 4D that the document has been modified. c4d.EventAdd() # Execute main() if __name__=='__main__': main()
-
RE: GetActiveToolData() doesn't work for Mirror Tool
Are there any workarounds for this?
-
RE: Howto add headers & dividers for a ShowPopupDialog?
Actually i've got 'Type to search' popup field in C4D 2023.2.0 also, but POPUP_ALLOW_FILTERING flag is omitted.
Is there a way to hide it? -
RE: How to create a radial (pie) menu?
Thanks for your detailed answers, i hoped there is a simpler way to do it)...
Pie menus is a very common thing nowadays, why maxon developers haven't implemented it already?
In modo for example you can create pie menus, popups...etc without any coding.
Not every user is ready/have the time/etc to learn python to build a simple popup, but almost every user needs to customize their working software.
I really hope you'll implement these features soon. -
GetActiveToolData() doesn't work for Mirror Tool
Hi, i'm trying to change Mirror Tool settings, but when i get them using GetActiveToolData() it returns me 'None'. Also i've noticed that changing tool settings in the Attributes tab doesn't show up anything in the Script Log, usually i can see tool setting's name and corresponding value in the log.
Tried both in C4D R26 and 2023.2.0.
Is it a bug or i'm missing something?
Thanks.
import c4d def main(): doc = c4d.documents.GetActiveDocument() c4d.CallCommand(14038) # Mirror settings = doc.GetActiveToolData() print("settings: %s" % settings) settings[c4d.MDATA_MIRROR_VALUE] = 0.0 settings[c4d.MDATA_MIRROR_SYSTEM] = 0 c4d.EventAdd() # Execute main() if __name__=='__main__': main()