.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
copy block
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
115 Views, 5 Replies
11-09-2005 04:09 AM
hi,
I am unable to copy a block from one ACAD drawing to another can any one help me on this.
thanks in advance
namrata
I am unable to copy a block from one ACAD drawing to another can any one help me on this.
thanks in advance
namrata
*Lisa
Re: copy block
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-09-2005 10:42 AM in reply to:
namrata.nekkanti
cut and paste it?
wrote in message news:5007941@discussion.autodesk.com...
hi,
I am unable to copy a block from one ACAD drawing to another can any one
help me on this.
thanks in advance
namrata
hi,
I am unable to copy a block from one ACAD drawing to another can any one
help me on this.
thanks in advance
namrata
Re: copy block
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-09-2005 08:43 PM in reply to:
namrata.nekkanti
yah copy and paste using dot net API
regards,
namrata
regards,
namrata
*Bobby C. Jones
Re: copy block
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-11-2005 10:38 AM in reply to:
namrata.nekkanti
Here's an example to start with.
public void CopyBlock(string sourceFileName, string blockName)
{
try
{
using(Database sourceDatabase =
GetDatabaseFromFile(sourceFileName))
{
HostApplicationServices.WorkingDatabase.Insert(blo ckName, sourceDatabase,
false);
}
}
catch (Autodesk.AutoCAD.Runtime.Exception e)
{
//Application.ShowAlertDialog(e.Message);
}
}
public Database GetDatabaseFromFile(string fileName)
{
Database databaseFromFile = new Database(false, true);
databaseFromFile.ReadDwgFile(fileName, System.IO.FileShare.None,
false, null);
return databaseFromFile;
}
--
Bobby C. Jones
http://www.acadx.com
wrote in message news:5007941@discussion.autodesk.com...
hi,
I am unable to copy a block from one ACAD drawing to another can any one
help me on this.
thanks in advance
namrata
public void CopyBlock(string sourceFileName, string blockName)
{
try
{
using(Database sourceDatabase =
GetDatabaseFromFile(sourceFileName))
{
HostApplicationServices.WorkingDatabase.Insert(blo
false);
}
}
catch (Autodesk.AutoCAD.Runtime.Exception e)
{
//Application.ShowAlertDialog(e.Message);
}
}
public Database GetDatabaseFromFile(string fileName)
{
Database databaseFromFile = new Database(false, true);
databaseFromFile.ReadDwgFile(fileName, System.IO.FileShare.None,
false, null);
return databaseFromFile;
}
--
Bobby C. Jones
http://www.acadx.com
hi,
I am unable to copy a block from one ACAD drawing to another can any one
help me on this.
thanks in advance
namrata
Re: copy block
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-13-2005 11:54 PM in reply to:
namrata.nekkanti
this code snippet is giving an eror
it says " self refrenced"
it says " self refrenced"
*Bobby C. Jones
Re: copy block
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-14-2005 12:58 PM in reply to:
namrata.nekkanti
The example I posted probably isn't what you're looking for and if you used
it to try and copy a block from a drawing into another with the same name,
then I imagine that is the error you would get :-)
This is the overload of the Insert method that I think you are after.
currentDatabase.Insert(sourceBlockName, destinationBlockName,
sourceDatabase, true);
However, this is creating two btr's. The one with the name provided as the
sourceBlockName parameter is good, but the one provided as the
destinationBlockName is empty and can be purged. I did a quick search on
the ADN site and this was reported a while back. Like in the R2004
timeframe.
--
Bobby C. Jones
http://www.acadx.com
wrote in message news:5011912@discussion.autodesk.com...
this code snippet is giving an eror
it says " self refrenced"
it to try and copy a block from a drawing into another with the same name,
then I imagine that is the error you would get :-)
This is the overload of the Insert method that I think you are after.
currentDatabase.Insert(sourceBlockName, destinationBlockName,
sourceDatabase, true);
However, this is creating two btr's. The one with the name provided as the
sourceBlockName parameter is good, but the one provided as the
destinationBlockName is empty and can be purged. I did a quick search on
the ADN site and this was reported a while back. Like in the R2004
timeframe.
--
Bobby C. Jones
http://www.acadx.com
this code snippet is giving an eror
it says " self refrenced"
