Friday, August 19, 2005

VBScript formula that uses the ADT API

After reading this blog post by Richard Binning, Beside the Cursor about ADT: VBScripting Resources List I recall a little VBScript for ADT that I've used in a Formula Property Definition in a Property Set Definition. I wanted to schedule the width of the wall that the door is anchored to. These few rows solves this by using the Handle of the door and using the ADT API to get the Width.


on error resume next
Set app=GetObject(,"AutoCAD.Application")
Set aDoor = app.activedocument.handletoobject("[Handle]")
Set anAnchor = aDoor.GetAnchor
Set aWall = anAnchor.Reference
RESULT= aWall.Width

No comments:

Post a Comment