.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Door Property Sets

1 REPLY 1
Reply
Message 1 of 2
Anonymous
207 Views, 1 Reply

Door Property Sets

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:
1 REPLY 1
Message 2 of 2
jimmie_fulton
in reply to: Anonymous

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost