Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Check if object is a polygonal parametric object

    Scheduled Pinned Locked Moved PYTHON Development
    9 Posts 0 Posters 700 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 16/07/2015 at 15:27, xxxxxxxx wrote:

      I know that obj.GetInfo() & c4d.OBJECT_ISSPLINE will return True if the obj is a spline, no matter if it is a "manual" spline or a parametric spline.
      But how can I check if a object is a parametric "polygonal" object?
      I mean, how can I check if an object, even if it is a generator, generates a polygonal object?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 16/07/2015 at 17:49, xxxxxxxx wrote:

        Hi
        flash idea - op.GetPointCount() ?!

        or i'm finding solutions that someone make dict with oplist of id's and check out ops from dict

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 16/07/2015 at 18:03, xxxxxxxx wrote:

          I want to consider parametric objects as candidates that fulfill the check.
          So, a Cube or a Sphere would be considered as "polygonal" objects by my code, even if they start as parametric.
          But a Light or a Null would not, because they produce no geometry.
          So, the op.GetPointCount() would not work as it only works with really polygonal objects.

          I guess I will have to create a list with all the IDs and check with something like:

          if op.GetType() in ID_list:

          Not as elegant and much more complex.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 16/07/2015 at 18:28, xxxxxxxx wrote:

            Hello Rui,

            you might need some additional if clauses for PythonGenerators, but basically you can use something like this snippet(in R16- otherwise  if op.GetType() == c4d.Opolygon:

              
              if not op: return  
              
              if op.IsInstanceOf(c4d.Opolygon) :  
                  print "polygonalobject"  
              else:  
                  base = op.GetCache()  
                  if base:  
                      if base.IsInstanceOf(c4d.Opolygon) :  
                          print "polygonalobject"  
              
            

            Hope this helps?
            Best Wishes
            Martin

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 17/07/2015 at 01:31, xxxxxxxx wrote:

              Hello,

              there are no "polygonal parametric" objects. In Cinema there are generators that fill a cache – possibly with polygon objects. So you would have to check if a given object is a generator and then search the cache for polygon objects.

              See also

              • "Polygon-Object or Scene Object"
              • "Detecting if a BaseObject is a Generator"

              Best wishes,
              Sebastian

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 17/07/2015 at 01:45, xxxxxxxx wrote:

                I know there are no "polygonal parametric" objects. It was just a way to differentiate parametric objects that generate geometry from the ones that don't

                I will check out that cache thing.
                Thank you all.

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  On 22/10/2015 at 03:59, xxxxxxxx wrote:

                  Hello
                  Sorry for necromancy of topic 😉

                  I found additional similar method, ... well known method:

                  if hasattr(op, 'GetAllPoints') == False: return # or any stuff with procedural
                  

                  else -   possible to csto procedural and return point op

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    On 22/10/2015 at 06:57, xxxxxxxx wrote:

                    @Ilya: That would be the same as using op.CheckType(c4d.Opoint). The OP wanted to know whether the
                    object generates  a polygonal object, not if it is  a polygonal object. And actually you'd have to test for
                    c4d.Opolygon  and 'GetAllPolygons' , otherwise you'd only check for point objects.

                    -N

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      On 22/10/2015 at 07:09, xxxxxxxx wrote:

                      Originally posted by xxxxxxxx

                      @Ilya: That would be the same as using op.CheckType(c4d.Opoint). The OP wanted to know whether the
                      object generates  a polygonal object, not if it is  a polygonal object. And actually you'd have to test for
                      c4d.Opolygon  and 'GetAllPolygons' , otherwise you'd only check for point objects.

                      -N

                      Hi
                      Argh, thank you
                      i made universal link-gui to op(without ACCEPT flag), i got this method when i looked at console and it wrote about no attribute. Then i remember my battles with pySide, SWIG... expesially attributes for objects and etc.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post