Saturday, February 24, 2024

How to make a Revcloud in Python for AutoCAD

 

There isn’t a “revcloud” entity type in Autocad, but you can make one with a polyline and enlisting the help of send command.  Here’s the sample code

 

import traceback
import PyRx as Rx
import PyGe as Ge
import PyGi as Gi
import PyDb as Db
import PyAp as Ap
import PyEd as Ed

import AxApp24 as Ax

def PyRxCmd_doit() -> None:
    try:
        # get the app, doc and model space
        axApp = Ax.getApp()
        doc = axApp.ActiveDocument
        ms = doc.ModelSpace

        # coords for the cloud and create a polyline
        coords = [0, 0, 0, 0, 1000, 0, 1000, 1000, 0, 1000, 0, 0, 0, 0, 0]
        pl = ms.AddPolyline(coords)
       
        #use send command to create the revcloud, note the (A)arc length
        handle = '(handent "{}")'.format(pl.Handle)
        doc.SendCommand("revcloud A {} Object {} Y ".format(200, handle))

    except Exception as err:
        traceback.print_exception(err)


 

And the result:

 


TraceBoundary sample in Python for AutoCAD

    import traceback from pyrx_imp import Rx from pyrx_imp import Ge from pyrx_imp import Gi from pyrx_imp import Db from pyrx_imp...