MCOMMAND_CURRENTSTATETOOBJECT

On 05/11/2015 at 02:50, xxxxxxxx wrote:

In R14 this piece of code to make an object a polygon object before inserting it in the document works:

[   B_cyl = c4d.BaseObject(c4d.Ocylinder)
    B_cyl[c4d.PRIM_CYLINDER_CAPS] = False
    B_cyl[c4d.PRIM_CYLINDER_RADIUS] = 50
    B_cyl[c4d.PRIM_CYLINDER_HEIGHT] = 50
    B_cyl[c4d.PRIM_CYLINDER_HSUB] = 3
    B_cyl[c4d.PRIM_CYLINDER_SEG] = 36
    B_cyl[c4d.PRIM_AXIS] = 2
    
    
    B_cyl_to_obj = c4d.utils.SendModelingCommand(c4d.MCOMMAND_CURRENTSTATETOOBJECT, 
                                                doc = doc, 
                                                list = [B_cyl])
       
    B_cyl_obj = B_cyl_to_obj[0]    
    B_cyl_obj_pnts = B_cyl_obj.GetAllPoints()
        
    B_cyl_obj.InsertUnder(obj_null)]

But in R12 and R13 it does not. Is there a workaround for this????

On 06/11/2015 at 00:21, xxxxxxxx wrote:

Ok, I have done this and it seems to be working. I created a temp document for my object and work from there.

[B_cyl = c4d.BaseObject(c4d.Ocylinder)
    B_cyl[c4d.PRIM_CYLINDER_CAPS] = False
    B_cyl[c4d.PRIM_CYLINDER_RADIUS] = 50
    B_cyl[c4d.PRIM_CYLINDER_HEIGHT] = 50
    B_cyl[c4d.PRIM_CYLINDER_HSUB] = 3
    B_cyl[c4d.PRIM_CYLINDER_SEG] = 36
    B_cyl[c4d.PRIM_AXIS] = 2
        
    temp_doc = c4d.documents.BaseDocument()
    
    temp_doc.InsertObject(B_cyl)
    Bcyl_obj = temp_doc.SearchObject("Cylinder")
    
    B_cyl_to_pol = c4d.utils.SendModelingCommand(c4d.MCOMMAND_CURRENTSTATETOOBJECT, 
                                                 doc = temp_doc, 
                                                 list = [Bcyl_obj])
       
    B_cylObj = B_cyl_to_pol[0]    
    B_cylObj_pnts = B_cylObj.GetAllPoints()

print B_cylObj_pnts
    ]

Is there any cons going this way???

On 06/11/2015 at 05:04, xxxxxxxx wrote:

Hi,

no, there speaks nothing against it. Actually your second solution is way safer than the first approach. SendModelingCommand() should always be send to objects, which reside in the passed document.

On 06/11/2015 at 20:34, xxxxxxxx wrote:

@Andreas Block

Thanks I will stick with the second one