Bricscad Python



Bricscad Python

  1. Bricscad Python Free
  2. Bricscad Python

Abstract A Python package to create and modify DXF drawings, independent of the DXF version. You can open/save every DXF file without losing any content (except comments), Unknown tags in the DXF file will be ignored but preserved for saving. BricsCAD (Linux) V16,V17 is built with gcc 4.8.2 on Ubuntu 14.04 LTS. As a result the minimum required c runtime (libstdc) is 4.8.2. In practice, BricsCAD (Linux) can run on almost any distribution that is newer than Ubuntu 14.04. We receive many support requests for other distributions. A new scripting engine will be built into the next release of ADACX that will enable both BricsCAD, AutoCAD and ADACX to be scripted in the user friendly Python programming language! This will enable end users to create simple text based automation scripts to automate not only ADACX but also BricsCAD/AutoCAD. Interface Elements 1. In BricsCAD, toolbars are arranged in collections of similar functions within a bar of tools. A ribbon organizes tools in a series of panels (11) which are grouped in different tabs (12). Working with Document Tabs.

Bricscad Python

Bricscad Python Free

Comments

Code

Bricscad Python

Bricscad
  • import win32com.client
    acad = win32com.client.Dispatch('BricscadApp.AcadApplication')
    model = doc.ModelSpace
    util = doc.Utility
    print acad, doc,model,paper, util,blocks
    print sCurName
  • Could it be that :
    model.AddLine((0,0),(0,10))
    is looking for a 3d point?
    model.AddLine((0,0,0),(0,10,0))

  • line = model.AddLine((0,0,0),(0,10,0)) # cause error
    line = model.AddLine('0,0,0','0,10,0') # it works
    It's weird. In the developer's guide startpoint and endpoint is arraylike variables. In other programs such as Nanocad this code works correctly
  • The problem was with the type of the array. Bricscad requires an array type VT_ARRAY | VT_R8. Python lists do not match this type. This problem is solved with the creation of the array of the appropriate type in python by the command array('d', >).win32com replaced by comtypes library.
    from array import array
    import comtypes.client
    acad = comtypes.client.GetActiveObject('BricscadApp.AcadApplication')
    model = doc.ModelSpace
    util = doc.Utility
    print acad, doc,model,paper, util,blocks
    print sCurName
    pnt2 = array('d',(0,10,0))
  • Hello all,

    How do you implement your code in Bricscad? I have been working strictly in Lisp thus far, and have some Python experience and love the language. Sounds interesting.

  • I connect to Bricscad COM API using comtypes library. I run the script from the outside.
  • I get this error when trying to access Bricscad from the Python Shell. I have imported comtypes.client and I have Bricscad running.

    >>> acad=comtypes.client.GetActiveObject('BricscadApp.AcadApplication')
    Traceback (most recent call last):
    File ', line 1, in
    acad=comtypes.client.GetActiveObject('BricscadApp.AcadApplication')
    File 'C:Python34libsite-packagescomtypesclient__init__.py', line 180, in GetActiveObject
    obj = comtypes.GetActiveObject(clsid, interface=interface)
    File 'C:Python34libsite-packagescomtypes__init__.py', line 1238, in GetActiveObject
    oledll.oleaut32.GetActiveObject(byref(clsid), None, byref(p))
    File '_ctypes/callproc.c', line 920, in GetResult
    OSError: [WinError -2147221021] Operation unavailable
    >>>

    Any ideas on what will cause this error?

    Thanks,

    Kevin

  • I get this error when trying to access Bricscad from the Python Shell. I have imported comtypes.client and I have Bricscad running.

    >>> acad=comtypes.client.GetActiveObject('BricscadApp.AcadApplication')
    Traceback (most recent call last):
    File ' ', line 1, in
    acad=comtypes.client.GetActiveObject('BricscadApp.AcadApplication')
    File 'C:Python34libsite-packagescomtypesclient__init__.py', line 180, in GetActiveObject
    obj = comtypes.GetActiveObject(clsid, interface=interface)
    File 'C:Python34libsite-packagescomtypes__init__.py', line 1238, in GetActiveObject
    oledll.oleaut32.GetActiveObject(byref(clsid), None, byref(p))
    File '_ctypes/callproc.c', line 920, in GetResult
    OSError: [WinError -2147221021] Operation unavailable
    >>>

    Any ideas on what will cause this error?

    Thanks,

    Kevin

    Perhaps you're trying to connect to a 64 bit version of Bricscad. For this you need a 64 bit version comtypes and python
  • Thanks Akim, I was running a 32 bit version of Bricscad. Re-installed it as 64 bit and it works. Thanks for the advise.