.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Model / Render Type GsClassFac tory
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Anyone know the equivalent of getting a AcGsModel with a render type of kDirect similar to that of the old BlockView example in ObjectArx. The function used the AcGsClassFactory::createModel(...) but I cannot seem to find an equivalent to this in .Net.
I am currently using an in-memory Database to display graphical objects. Now I want to add "Ghost" objects to the View where they are not added to the Database and displayed over-top of the database resident objects. How can I accomplish this in .Net.
Any tips would be appreciated.
Thanks
Mike
Re: Model / Render Type GsClassFac tory
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Maybe TransientGraphics?
Re: Model / Render Type GsClassFac tory
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Have you looked at the BlockView.NET sample?
Re: Model / Render Type GsClassFac tory
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have, and based my view on that. The difference is that the BlockView .Net example does not include the orbit object which the original block view has.
- Mike
Re: Model / Render Type GsClassFac tory
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
It seems like the transient api is definitely the way for you... Check out Keans blog http://through-the-interface.typepad.com/through_t
In terms of creating an AutoCAD model using .NET, here's some code that might be useful to someone. I wrote it pretty quickly so please excuse any bugs, logic errors.
// command to generate DWG and Block thumbnail
// by Fenton Webb, DevTech, 24/1/2013
[CommandMethod("GENERATETHUMBS")]
public void GenerateThumbnailBitmaps()
{
Editor ed = Application.DocumentManager.MdiA
// get the output path for the bitmaps
PromptStringOptions opts = new PromptStringO
opts.AllowSpaces = true;
PromptResult res = ed.GetString(opts);
// if ok
if (res.Status == PromptStatus.OK)
{
try
{
// make sure the folder exists
DirectoryInfo outputPathInfo = new Direc
if (outputPathInfo.Exists)
{
Point2d screenSize = (Point2d)Applicat
// set up the image sizes
int width = (int)screenSize.X;
int height = (int)screenSize.Y;
Document doc = Application.DocumentMan
Database db = doc.Database;
// get the dwg file name
FileInfo dwgPath = new FileInfo(doc.Na
// get the document graphics system ma
Manager gsm = doc.GraphicsManager;
// construct the default filename pref
string defaultPath = outputPathInfo.Fu
// first generate the MS screen shot
View acadView = gsm.GetGsView(2, true)
Rectangle rect = new Rectangle(0, 0, w
using (Bitmap msBmp = acadView.GetSnap
msBmp.Save(defaultPath + " MS.bmp");
// now set the block sizes to somethin
width = 800;
height = 600;
// now generate the layout images
// first remember the current layout
string currentLayout = LayoutManager.C
// now lets loop the layouts, open the
using (DBDictionary layoutDict = db.La
{
// now iterate the layouts and get t
foreach (DBDictionaryEntry layoutEnt
{
string layoutName = layoutEntry.Ke
LayoutManager.Current.CurrentLayou
using (Bitmap layoutBmp = doc.Capt
layoutBmp.Save(defaultPath + " "
/*View layoutView = gsm.GetGsView(
rect = new Rectangle(0, 0, width,
using (Bitmap layoutBmp = layoutVi
layoutBmp.Save(defaultPath + " "
}
}
// restore the original layout
LayoutManager.Current.CurrentLayout =
// now create an off screen device
using (Device offDevice = gsm.CreateAu
{
// now size the device
offDevice.OnSize(new System.Drawing.
// now create the view
using (View view = new View())
{
// add the new view object to the
offDevice.Add(view);
// update it
offDevice.Update();
// ok now create the model
using (Model model = gsm.CreateAut
{
using (BlockTable bt = db.BlockT
{
// now iterate through our blo
foreach (ObjectId id in bt)
{
// open the btr for read
using (BlockTableRecord btr
{
// get the name of the blo
string btrName = btr.Name;
// add the btr to the view
view.Add(btr, model);
try
{
// get the extents of th
Extents3d extents = new
extents.AddBlockExtents(
// now zoom extents of t
view.ZoomExtents(extents
// finally, construct th
string imagePath = defau
// clean up the path
imagePath = imagePath.Re
// snap the image
rect = new Rectangle(0,
using (Bitmap blockBmp =
blockBmp.Save(imagePat
}
catch
{
}
// reset the view for the
view.EraseAll();
}
}
}
}
offDevice.EraseAll();
}
}
}
else
ed.WriteMessage("\nThe Path is invalid
}
catch
{
ed.WriteMessage("\nThe Path cannot be wr
}
}
}
Fenton Webb
Developer Technical Services
Autodesk Developer Network
