Jump to content

change setting from script


Recommended Posts

Hi,

 

in modelling settings there is a section mesh checking. I want to toggle the option "Not planar polygons" with a key shortcut. Is there a possibility to do that?

 

What I tried is to record the change of this setting in the script log, but it does not record the event of changing this setting, so I don't know the command id to change this setting. Otherwise I would use c4d.CallCommand from a script to change this setting and assign this script a shortcut. Has anyone an idea how to solve this? Thank you!

Link to post

The mesh checking options are hidden away in the snap settings tools...

 

import c4d
from c4d.modules import snap

def main():
    bc = snap.GetSnapSettings(doc)
    isSet = bc.GetBool(c4d.MESH_CHECK_NORMAL,True)
    bc.SetBool(c4d.MESH_CHECK_NORMAL,not isSet)
    snap.SetSnapSettings(doc, bc)
    c4d.EventAdd()    
    
if __name__=='__main__':
    main()

 

Find more scripting stuff under

https://www.patreon.com/cairyn

(first 2 parts are free)

Link to post
8 minutes ago, iamnew said:

This seems not to be documented? Trying to find the constant for non planar polygons option and can't find it.

 

Select the option in the tools window (not the checkbox, the description text). Drag the option to the Console window. There you go.

(MESH_CHECK_NORMAL is already the correct constant for non planar polygons though.)

 

Link to post
2 hours ago, Cairyn said:

 

Select the option in the tools window (not the checkbox, the description text). Drag the option to the Console window. There you go.

(MESH_CHECK_NORMAL is already the correct constant for non planar polygons though.)

 

Thanks, that is a cute nice trick. 

Link to post

Okay, I have still a small problem. In the UI the option is now switched but nothing happens in the 3d viewer? I am missing something? It is like an "update" is missing or something.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...