Thursday, January 25, 2007

ADT Window Style Type in a PSD

I noticed a question on the Architectural Desktop discussion group and wanted to share the solution here. The Window Type for a windows style is not available as an automatic property. So a bit of VBScript is needed.

Create a PSD (Property Set Definition) that applies to Windows styles and add the automatic property Handle. Then add the formula below in the Formula Property Definition. Notice that [Handle] in the formula must be selected from the "Insert Property Definitions" list.

In the code AecX.AecArchBaseApplication.5.0 refers to ADT 2007.

For other versions of ADT change it.

ADT 2004 - AecX.AecArchBaseApplication.4
ADT 2005 - AecX.AecArchBaseApplication.4.5
ADT 2006 - AecX.AecArchBaseApplication.4.7
ADT 2007 - AecX.AecArchBaseApplication.5.0
ACA 2008 - AecX.AecArchBaseApplication.5.5

On Error Resume Next Set app = GetObject(, "AutoCAD.Application") Set AecArchBaseApplication = app.GetInterfaceObject("AecX.AecArchBaseApplication.5.0") Set doc = AecArchBaseApplication.ActiveDocument Set WindowStyles = doc.WindowStyles Set WindowObject = doc.HandleToObject("[Handle]") Set WindowStyle = WindowStyles.Item(WindowObject.StyleName) Select Case WindowStyle.Type Case 0 RESULT = "Custom" Case 1 RESULT = "Picture" Case 2 RESULT = "Single Hung" Case 3 RESULT = "Double Hung" Case 4 RESULT = "Awning - Transom" Case 5 RESULT = "Double Casement" Case 6 RESULT = "Glider" Case 7 RESULT = "Hopper - Transom" Case 8 RESULT = "Pass Through" Case 9 RESULT = "Single Casement" Case 10 RESULT = "Single Hopper" Case 11 RESULT = "Single Awning" Case 12 RESULT = "Vertical Pivot" Case 13 RESULT = "Horizontal Pivot" Case 14 RESULT = "Uneven Single Hung" Case 15 RESULT = "Uneven Double Hung" End Select

1 comment:

  1. Restored comments
    TinyE said...

    Thanks for the clear instructions, I'll have to utilize this.
    January 25, 2007

    jack dawg said...

    Do you have any suggestions for exstracting the wall stud width(not entire wall with) of wall styles. Can I make it an Automatic Property Source? Thank you for any help given
    April 17, 2007

    JTB World said...

    jack dawg,
    There is no easy way to do this since these properties are not yet exposed through ActiveX (even in ACA 2008). It would require a more complex solution using the .NET API where the WallStyleComponents collection is exposed.
    April 19, 2007

    ReplyDelete

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner

Contact Us | About JTB World | Subscribe to this blog
JTB World's website | Website General Terms of Use | Privacy Policy
^ Top of page

© 2004- JTB World. All rights reserved.