Jump to content
Sign in to follow this  
nikosliapis

Autoit and Autocad

Recommended Posts

nikosliapis

Hello to everyone. I would like to know if anyone of the comunity has ever used autoit for use with autocad.

I did a litle search in the forum but didn't find anythink

I am intersted in "counting" thinks from an autocad file (ex. how many objects of a specific block are there in a autocad file, measuring distances and thinks like that). I am not interested in creating Autocad files.

Are there any UDFs or macros that i could use.

I would appreciate anu help given

Thanks in advance


Coding can be fun when you do it your own.

Share this post


Link to post
Share on other sites
Jeff West

Here's a snippet I got from somewhere that may help you get started:

$oAcad = ObjGet("","AutoCAD.Application.16")
If @error Then
    Msgbox(0,"ObjGet","Failed to open AutoCAD.Application.16 Object. Error code: " & hex(@error,8))
    Exit
Endif

$strActiveDocument = $oAcad.Activedocument.Name
MsgBox(0,"$oAcad.Activedocument.Name",$strActiveDocument)

$iBlocks = $oAcad.Activedocument.Blocks.Count
MsgBox(0,"$oAcad.Activedocument.Blocks.Count",$iBlocks)
For $i = 0 to $iBlocks -1
    $strBlockName = $oAcad.Activedocument.Blocks.Item($i).name
    If $strBlockName = "TITLEBLOCK" Then
        $iAttributes = $oAcad.Activedocument.Blocks.Item($i).GetAttributes()
        MsgBox(0,"GetAttributes()",$iAttributes)
    EndIf
Next

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.