using acedCommand to redefine a block insert

using acedCommand to redefine a block insert

Anonymous
Not applicable
702 Views
5 Replies
Message 1 of 6

using acedCommand to redefine a block insert

Anonymous
Not applicable
In my code, Im checking to see if a particular block exists before atteming to insert a new one.
If if does exist, I want to redefine it, but when I put a "yes" in the command string at the point
where the insert command would ask for it, it doesnt seem to work. I still get the old block inserted.
Can someone tell me what I have done wrong here, or if this is even possible this way?
Thanks
Perry

code snippet---------------------------------------------------------------------------------------
if (blockExists)
acedCommand(RTSTR, "INSERT",
RTSTR, windInfo.sTitleBlockToInsert, //blockname,
RTSTR, "YES", //answer redefinition prompt
RTSTR, "0,0", //insertion point,
RTSHORT, 1, //xscale,
RTSHORT, 1, //yscale,
RTSHORT, 0, //rotation angle
RTNONE);
else
acedCommand(RTSTR, "INSERT",
RTSTR, windInfo.sTitleBlockToInsert, //blockname,
RTSTR, "0,0", //insertion point,
RTSHORT, 1, //xscale,
RTSHORT, 1, //yscale,
RTSHORT, 0, //rotation angle
RTNONE);
0 Likes
703 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
You show code that calls acedCommand, and
passes variables as params, but you do not
show what the actual value(s) of the variable(s)
are, which means that it is difficult to help you,
since we don't know what you're actually passing
to acedCommand().

I will take a guess, that your variable contains
the name of the block, which isn't going to tell
AutoCAD to redefine it.

To redefine an existing block, you need to use
blockname=filename (or blockname= if the block
and filename are the same, and the file is in the
search path).

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"perry" wrote in message news:4901664@discussion.autodesk.com...
In my code, Im checking to see if a particular block exists before atteming to insert a new one.
If if does exist, I want to redefine it, but when I put a "yes" in the command string at the point
where the insert command would ask for it, it doesnt seem to work. I still get the old block inserted.
Can someone tell me what I have done wrong here, or if this is even possible this way?
Thanks
Perry

code snippet---------------------------------------------------------------------------------------
if (blockExists)
acedCommand(RTSTR, "INSERT",
RTSTR, windInfo.sTitleBlockToInsert, //blockname,
RTSTR, "YES", //answer redefinition prompt
RTSTR, "0,0", //insertion point,
RTSHORT, 1, //xscale,
RTSHORT, 1, //yscale,
RTSHORT, 0, //rotation angle
RTNONE);
else
acedCommand(RTSTR, "INSERT",
RTSTR, windInfo.sTitleBlockToInsert, //blockname,
RTSTR, "0,0", //insertion point,
RTSHORT, 1, //xscale,
RTSHORT, 1, //yscale,
RTSHORT, 0, //rotation angle
RTNONE);
0 Likes
Message 3 of 6

Anonymous
Not applicable
Tony Tanzillo wrote:
> You show code that calls acedCommand, and
> passes variables as params, but you do not
> show what the actual value(s) of the variable(s)
> are, which means that it is difficult to help you,
> since we don't know what you're actually passing
> to acedCommand().
>
> I will take a guess, that your variable contains
> the name of the block, which isn't going to tell
> AutoCAD to redefine it.
>
> To redefine an existing block, you need to use
> blockname=filename (or blockname= if the block
> and filename are the same, and the file is in the
> search path).
>
Yes Tony Im passing in a variable for the block name. In this case it evaluates to:
"C:\Documents and Settings\perry\My Documents\My code\C++\Acad\tblocker 2002\Debug\title blocks\title-b2.dwg"
So I thought this would redefine the block existing in the drawing by the name of "title-b2".
Apparently, Im wrong about this.
0 Likes
Message 4 of 6

Anonymous
Not applicable
> Yes Tony Im passing in a variable for the block name. In this case it evaluates to:
> "C:\Documents and Settings\perry\My Documents\My code\C++\Acad\tblocker 2002\Debug\title blocks\title-b2.dwg"
> So I thought this would redefine the block existing in the drawing by the name of "title-b2".
> Apparently, Im wrong about this.

No comment?
0 Likes
Message 5 of 6

Anonymous
Not applicable
No comment about what?

I already mentioned that to redefine a block from a DWG
file, you must use "blockname=filename" with INSERT, not
just the filename.

So, your parameter for the blockname with INSERT would
be something like

"TITLE-B2=C:\...\title blocks\title-b2.dwg".

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"perry" wrote in message news:4906918@discussion.autodesk.com...
> Yes Tony Im passing in a variable for the block name. In this case it evaluates to:
> "C:\Documents and Settings\perry\My Documents\My code\C++\Acad\tblocker 2002\Debug\title blocks\title-b2.dwg"
> So I thought this would redefine the block existing in the drawing by the name of "title-b2".
> Apparently, Im wrong about this.

No comment?
0 Likes
Message 6 of 6

Anonymous
Not applicable
Tony Tanzillo wrote:
> No comment about what?
>
> I already mentioned that to redefine a block from a DWG
> file, you must use "blockname=filename" with INSERT, not
> just the filename.
>
> So, your parameter for the blockname with INSERT would
> be something like
>
> "TITLE-B2=C:\...\title blocks\title-b2.dwg".
>
Ok, I was not aware of the need for the "dwg=..." part in front of the path name.
Thanks
Perry
0 Likes