Autodesk.Aec.DatabaseServices.MultiViewBlockReference

Autodesk.Aec.DatabaseServices.MultiViewBlockReference

chris.j.mckeown
Contributor Contributor
1,057 Views
5 Replies
Message 1 of 6

Autodesk.Aec.DatabaseServices.MultiViewBlockReference

chris.j.mckeown
Contributor
Contributor
How do I find the definition of a Autodesk.Aec.DatabaseServices.MultiViewBlockReference? So far I have:

I can track down the MultiViewBlockReference but not the definition of it.

private void callback_ObjectAppended(object sender, ObjectEventArgs e)
{
if (e.DBObject.ToString() == "Autodesk.Aec.DatabaseServices.MultiViewBlockReference")
{
Database db = Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager;
using (Transaction tr = tm.StartTransaction())
{
//
}
}
}

Regards

Chris
0 Likes
1,058 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
You have to typecast the DBObject to a MultiViewBlockReference.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6311300@discussion.autodesk.com...
How do I find the definition of a
Autodesk.Aec.DatabaseServices.MultiViewBlockReference? So far I have:

I can track down the MultiViewBlockReference but not the definition of it.

private void callback_ObjectAppended(object sender, ObjectEventArgs e)
{
if (e.DBObject.ToString() ==
"Autodesk.Aec.DatabaseServices.MultiViewBlockReference")
{
Database db =
Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.DatabaseServices.TransactionManager tm =
db.TransactionManager;
using (Transaction tr = tm.StartTransaction())
{
//
}
}
}

Regards

Chris
0 Likes
Message 3 of 6

chris.j.mckeown
Contributor
Contributor
Hi Tony, I believe it’s the MultiViewBlockDefinition I'm really after, but is only appended to a drawing once (the first time) but want to get the MultiViewBlockDefinition each time a tag is inserted,
So my question is now how do I get the MultiViewBlockDefinition from a MultiViewBlockReference?

try
{
aecdb.MultiViewBlockReference ent = (aecdb.MultiViewBlockReference)tr.GetObject(Obj.ObjectId, OpenMode.ForWrite, true);
WriteLine(String.Format("ent.Name {0}:", ent.??????.ToString()));
}
catch (System.Exception ex)
{
Helper.Message(ex);
}

Chris
0 Likes
Message 4 of 6

Anonymous
Not applicable
Did you look at the documentation for the MultiViewBlockReference?

The properties and methods of the class should give you what you need.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6311328@discussion.autodesk.com...
Hi Tony, I believe it's the MultiViewBlockDefinition I'm really after, but is
only appended to a drawing once (the first time) but want to get the
MultiViewBlockDefinition each time a tag is inserted,
So my question is now how do I get the MultiViewBlockDefinition from a
MultiViewBlockReference?

try
{
aecdb.MultiViewBlockReference ent =
(aecdb.MultiViewBlockReference)tr.GetObject(Obj.ObjectId, OpenMode.ForWrite,
true);
WriteLine(String.Format("ent.Name {0}:", ent.??????.ToString()));
}
catch (System.Exception ex)
{
Helper.Message(ex);
}

Chris
0 Likes
Message 5 of 6

chris.j.mckeown
Contributor
Contributor
Hi Tony, I have found how to access the MultiViewBlockDefinition from the MultiViewBlockReference via the StyleId

MultiViewBlockReference ent = (MultiViewBlockReference)tr.GetObject(Obj.ObjectId, OpenMode.ForRead, true);
MultiViewBlockDefinition mvbd = (MultiViewBlockDefinition)tr.GetObject(ent.StyleId, OpenMode.ForRead, true);

I have been looking for documentation on .net programming with ACA, without doing a course where is a good starting point to learn the ways and styles of programming correctly in ACA. I have been programming for years but am currently doing a Microsoft course in C#.net & sql...... so starting to build up a programming platform, but there is alot of ACA specific stuff to learn.

Chris
0 Likes
Message 6 of 6

Anonymous
Not applicable
Chris - You should probably focus more on C# and .NET
fundamentals before trying to extensively learn ACA, as the
former is a prerequisite to the latter.

For example, the code you show below calls GetObject() to
open an object that's already open. The DBObject passed
into the event handler is the MultiViewBlockReference, and
as I mentioned previously, you have to cast it to that type.

So, in terms of C# language concepts you're missing a few
very basic ones, namely how base classes and derived classes
relate to each other, (e.g., MultiViewBlockReference is derived
from DBObject), and how to cast an instance of a base type to
an instance of a derived type:

DBObject obj = e.DBObject // e is the ObjectModified event args:

MultiViewBlockReference mvblockRef = obj as MultiViewBlockReference;

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6311332@discussion.autodesk.com...
Hi Tony, I have found how to access the MultiViewBlockDefinition from the
MultiViewBlockReference via the StyleId

MultiViewBlockReference ent =
(MultiViewBlockReference)tr.GetObject(Obj.ObjectId, OpenMode.ForRead, true);
MultiViewBlockDefinition mvbd =
(MultiViewBlockDefinition)tr.GetObject(ent.StyleId, OpenMode.ForRead, true);

I have been looking for documentation on .net programming with ACA, without
doing a course where is a good starting point to learn the ways and styles of
programming correctly in ACA. I have been programming for years but am currently
doing a Microsoft course in C#.net & sql...... so starting to build up a
programming platform, but there is alot of ACA specific stuff to learn.

Chris
0 Likes