.NET

Reply
*Nate Hunter
Message 1 of 2 (85 Views)

Door Property Sets

85 Views, 1 Replies
02-16-2006 12:19 PM
I am trying to change the Property Set info of a door. i can get this code
to run in VBA but not in .net. I get hung up on the PropSets =
Sched.PropertySets(ReturnObj) I get return object from a line above this
code:
ThisDrawing.Utility.GetEntity(ReturnObj, basePnt, "Select the Door to Tag!")

In VBA this all works but in VB.NET is does not any ideas? And Yes it needs
to be done in .NET not VBA. Below is the code:

Dim ReturnObj as Object
Dim Sched As Autodesk.AEC.Interop.Schedule.AecScheduleApplication
Dim PropSets As
Autodesk.AEC.Interop.Schedule.AecSchedulePropertySets
Dim PropSet As Autodesk.AEC.Interop.Schedule.AecSchedulePropertySet


'**************
PropSets = Sched.PropertySets(ReturnObj) ' Returns Error
'**************
If Not PropSets.Count = 0 Then
For i = 0 To PropSets.Count - 1
PropSet = PropSets.Item(i)
If PropSet.Name = "DOORPLANNING" Then
For ii = 0 To PropSet.Properties.Count - 1
AecProp = PropSet.Properties.Item(ii)
If AecProp.Name = "DoorNo" Then AecProp.Value =
"600"
If AecProp.Name = "Location" Then AecProp.Value =
"TEST"
Next ii
End If
Next i
End If
GotProps:
Active Contributor
jimmie_fulton
Posts: 44
Registered: ‎04-06-2005
Message 2 of 2 (85 Views)

Re: Door Property Sets

02-17-2006 09:49 AM in reply to: *Nate Hunter
For using COM (aside from VBA), you have to do a bit more work to instantiate the AecScheduleApplication. You must allow AutoCAD to instantiate the object so that it knows which application is should get the schedule app from.

Here is some code that should get you started (sorry, c#):

AcadApplication app = (AcadApplication)Application.AcadApplication;
AecScheduleApplication sched = (AecScheduleApplication)app.GetInterfaceObject("AecX.AecScheduleApplication.4.7");

When working with ADT, you will find that you need to use this pattern above for instantiating certain ADT objects. For example, AecAnchorTagToEnt. The 4.7 corresponds to the COM library version, in this case for ADT 2006. You'll need to adjust this number for the version of ADT you are using. When you are getting null object errors, give this a try.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.