View Full Version : Novice Requires Help!

2005-01-10, 11:12 AM
Just trying to get my head round the basics, I want to write some code that inserts ADT2005 Structural Members. I have located the objects in the references, but am struggling to find an example of the syntax required. I have tried writing the code in the same manner as I would for a line but with no success.

The Code I have tried is as follows:

'Generate A Panel
Public Sub GenPanel()
Dim StPt As Variant
Dim EndPt As Variant
Dim BR As AecsMember

StPt = ThisDrawing.Utility.GetPoint(, vbCrLf & "Enter Start Point:")
EndPt = ThisDrawing.Utility.GetPoint(StPt, vbCrLf & "Enter End Point:")
Set BR = ThisDrawing.ModelSpace.AddCustomObject("AecsMember")(StPt, EndPt)
End Sub

"AddCustomObject("AecsMember")" I got from the help file, but I'm expect this is where I am going wrong!

Could some one point me in the right direction and or tell me where I could find some examples of code using ADT objects.

Any help would be gratefully received.


2005-01-10, 01:51 PM
Well, I don't have ADT installed on this box, but this line of code is probably your problem:

Set BR = ThisDrawing.ModelSpace.AddCustomObject("AecsMember")(StPt, EndPt)

There is no way you can have a back-to-back set of quotes [??? = () ()]. Look at the example again and re-check the syntax. The line should probably be:

Set BR = ThisDrawing.ModelSpace.AddCustomObject("AecsMember",StPt, EndPt)

If that isn't it, I'll check back later once I am in the office and have access to ADT.

2005-01-10, 05:02 PM
That makes more sense, still having problems though.

The help example for aecsmember is as follows:

VBA object name:

Create using:

And the help file for AddCustomObject is:

Sub Example_AddCustomObject()
' This example adds a custom object to model space.

' Load the ObjectARX application that defines the custom object.
' Note: The application listed here does not exist and
' will cause an error when run. Change the application name
' to the path and name of your ObjectARX Application.
ThisDrawing.Application.LoadArx ("MyARXApp.dll")

' Once the application has been loaded successfully,
' add the custom object to model space.
Dim customObj As AcadObject
Set customObj = ThisDrawing.ModelSpace.AddCustomObject("MyNewObject")

End Sub.

Surley the ObjectARX application will be already loaded in ADT?



Ed Jobe
2005-01-10, 05:35 PM
You should at least check. What if they started adt using the icon that loads acad only? If you try to add a custom object without the arx that is able to create it, you will get an error.