Creating Objects

Creating Objects

Anonymous
Not applicable
390 Views
7 Replies
Message 1 of 8

Creating Objects

Anonymous
Not applicable
Hello,

I know I can create my own custom objects and collections using class
modules. Can you create a displayable custom AutoCAD object and insert it
into a drawing?

I'd like to be able to draw "widget" object (say a displayable line) that
has all the properties of a line object (like layer, linetype, and geometry
data), but also has other properties and methods, like .density or
.materialtype. I know I can attach Xdata to objects (like dictionaries),
but I'd like to encapsulate these properties for easy code manipulation.

I hope I am making sense to someone.

So, can you do this in VBA? If not, what is the right tool to create these
new objects?

Thanks, Brian
0 Likes
391 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
You can't create custom objects without ObjectARX. I think the easiest way
would be to use XData. You could also create some function to help the
manipulation of XData, for example:

Public Function GetDensity(pLine as AcadLine) as Double
'Extracting XData
End Function

Public Sub SetDensity(pLine as AcadLine, pDensity as Double)
'Setting XData
End Function

Alain

"Brian Johnson" wrote in message
news:BE1BC1B7D908180FE53D65D4657504E7@in.WebX.maYIadrTaRb...
> Hello,
>
> I know I can create my own custom objects and collections using class
> modules. Can you create a displayable custom AutoCAD object and insert it
> into a drawing?
>
> I'd like to be able to draw "widget" object (say a displayable line) that
> has all the properties of a line object (like layer, linetype, and
geometry
> data), but also has other properties and methods, like .density or
> .materialtype. I know I can attach Xdata to objects (like dictionaries),
> but I'd like to encapsulate these properties for easy code manipulation.
>
> I hope I am making sense to someone.
>
> So, can you do this in VBA? If not, what is the right tool to create
these
> new objects?
>
> Thanks, Brian
>
0 Likes
Message 3 of 8

Anonymous
Not applicable
That's what I thought.

I have never messed with OjectARX. Is there a handy-dandy development
interface like VBA? How does ObjectARX relate to VBA and AutoCAD in terms
of development?

Thanks again!

Brian

"Alain Bouchard" wrote in message
news:9130877F76368B31DB4463504744A68A@in.WebX.maYIadrTaRb...
> You can't create custom objects without ObjectARX. I think the easiest way
> would be to use XData. You could also create some function to help the
> manipulation of XData, for example:
>
> Public Function GetDensity(pLine as AcadLine) as Double
> 'Extracting XData
> End Function
>
> Public Sub SetDensity(pLine as AcadLine, pDensity as Double)
> 'Setting XData
> End Function
>
> Alain
>
> "Brian Johnson" wrote in message
> news:BE1BC1B7D908180FE53D65D4657504E7@in.WebX.maYIadrTaRb...
> > Hello,
> >
> > I know I can create my own custom objects and collections using class
> > modules. Can you create a displayable custom AutoCAD object and insert
it
> > into a drawing?
> >
> > I'd like to be able to draw "widget" object (say a displayable line)
that
> > has all the properties of a line object (like layer, linetype, and
> geometry
> > data), but also has other properties and methods, like .density or
> > .materialtype. I know I can attach Xdata to objects (like
dictionaries),
> > but I'd like to encapsulate these properties for easy code manipulation.
> >
> > I hope I am making sense to someone.
> >
> > So, can you do this in VBA? If not, what is the right tool to create
> these
> > new objects?
> >
> > Thanks, Brian
> >
>
0 Likes
Message 4 of 8

Anonymous
Not applicable
> I have never messed with OjectARX.

Then, stay away from it unless you absolutely need it.

> Is there a handy-dandy development interface like VBA?

Nope. You need VC++ 6.0.

>How does ObjectARX relate to VBA and AutoCAD in terms of development?

A totally different object model and a totally different programming
approach. VB(A) is easy to use but less efficient. ObjectARX is more
efficient but you can crash AutoCAD easily.

____________________________________
Alain Bouchard, M.Sc.
Software Developer
Digital Photogrammetry Lab
Pavillon Casault
Laval University
G1K 7P4

Alain.Bouchard@scg.ulaval.ca
0 Likes
Message 5 of 8

Anonymous
Not applicable
Thanks for the info Alain.

-Brian

"Alain Bouchard" wrote in message
news:F924C8082A68DD302F63FFE22DE242BE@in.WebX.maYIadrTaRb...
> > I have never messed with OjectARX.
>
> Then, stay away from it unless you absolutely need it.
>
> > Is there a handy-dandy development interface like VBA?
>
> Nope. You need VC++ 6.0.
>
> >How does ObjectARX relate to VBA and AutoCAD in terms of development?
>
> A totally different object model and a totally different programming
> approach. VB(A) is easy to use but less efficient. ObjectARX is more
> efficient but you can crash AutoCAD easily.
>
> ____________________________________
> Alain Bouchard, M.Sc.
> Software Developer
> Digital Photogrammetry Lab
> Pavillon Casault
> Laval University
> G1K 7P4
>
> Alain.Bouchard@scg.ulaval.ca
>
0 Likes
Message 6 of 8

Anonymous
Not applicable
Are you sure you CANNOT create custom objects using VBA? I was glancing through a tutorial on this very subject on the VIP Point A site which showed you how to do it.
0 Likes
Message 7 of 8

Anonymous
Not applicable
You can create your own *classes* (and therefore objects) but these
are not custom drawing entities. An example of a custom object is
ARCTEXT. There is no way to create such an object with VB or VBA.

--
http://www.acadx.com

"jbryant4" wrote in message
news:f0499da.4@WebX.maYIadrTaRb...
> Are you sure you CANNOT create custom objects using VBA? I was
glancing through a tutorial on this very subject on the VIP Point A
site which showed you how to do it.
>
0 Likes
Message 8 of 8

Anonymous
Not applicable
With ObjectARX you can create your custom objects and AutoCAD gladly accepts as if its own entity.

With use of ATL (Active Template Library, I really do not know much about it) you can expose your objects to VBA. Also, with OPM you can get property sheet for your custom objects much like regular AutoCAD objects. These are just few of lot great things you can do with ObjectARX on custom onject front. Again, exposing your custiom objects to VBA helps lower programming cader to "play" with your object like -
DIM elbow as AcdbElbow or
DIM flange as AcdbFlange and then set properties like
Set flange.size = 4" or flange.rating = 300# and things like that.

Go for ObjectARX if you want to make real life objects.
Regards,
Nimish
0 Likes