Dim settings problem.. dimblk & dimldrblk

Dim settings problem.. dimblk & dimldrblk

Anonymous
Not applicable
1,757 Views
14 Replies
Message 1 of 15

Dim settings problem.. dimblk & dimldrblk

Anonymous
Not applicable
I've been trying to find a way to set these two settings in .NET.. but
to no avail..

they request the "objectid" of the block being used.. but I cant figure
out how to get it.. (i've tried the getobject method in the block table
but it does not work..)

the settings I want to use are:

DIMBLK - Architectural Tick ("_Archtick" by default in the help files)
DIMLDRBLK - Closed filled ("." by default in the help files)



Can anyone shed some light on this problem?
0 Likes
1,758 Views
14 Replies
Replies (14)
Message 2 of 15

Anonymous
Not applicable
The basic problem is that you're not familiar enough with
the API at the most basic levels (e.g., getting the Objectid
of a block given its name is a fairly basic concept).

If this is a learning exercise, you're getting ahead of yourself
and should probably try something simpler (like inserting a
block in the drawing, which also requires you to do the basic
lookup of the block's ObjectId). You can find a lot of code
here that shows how to get the ObjectId of a block. There
may also be some code in the API samples, but I can't say
for sure.

The short and skinny is that you have to open the block
table using GetObject(), and then call its Has() method
to see if the block exists. If it does, then you use:

blockTableObject[blockname];

which returns the ObjectId of the block whose name is
given as blockname.

--

http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"C Witt" wrote in message news:6094063@discussion.autodesk.com...
I've been trying to find a way to set these two settings in .NET.. but
to no avail..

they request the "objectid" of the block being used.. but I cant figure
out how to get it.. (i've tried the getobject method in the block table
but it does not work..)

the settings I want to use are:

DIMBLK - Architectural Tick ("_Archtick" by default in the help files)
DIMLDRBLK - Closed filled ("." by default in the help files)



Can anyone shed some light on this problem?
0 Likes
Message 3 of 15

Anonymous
Not applicable
I have already done the simple (like inserting a block). my problem
here (from what i can see) is that i don't KNOW the block names...? All
I can get from the help files is what to enter to get default values
(they don't give the "names").

I've even tried to extract the names from the preset values of existing
dimstyles (that didn't work either.. or perhaps i did that wrong)


as to the Has() method.. we know the block exists (as it's the default
setting for AutoCAD), so that does not help me at all..

Tony Tanzillo wrote:
> The basic problem is that you're not familiar enough with
> the API at the most basic levels (e.g., getting the Objectid
> of a block given its name is a fairly basic concept).
>
> If this is a learning exercise, you're getting ahead of yourself
> and should probably try something simpler (like inserting a
> block in the drawing, which also requires you to do the basic
> lookup of the block's ObjectId). You can find a lot of code
> here that shows how to get the ObjectId of a block. There
> may also be some code in the API samples, but I can't say
> for sure.
>
> The short and skinny is that you have to open the block
> table using GetObject(), and then call its Has() method
> to see if the block exists. If it does, then you use:
>
> blockTableObject[blockname];
>
> which returns the ObjectId of the block whose name is
> given as blockname.
>
0 Likes
Message 4 of 15

Anonymous
Not applicable
How are you trying to set the Variables? SetSystemVariable?
0 Likes
Message 5 of 15

Anonymous
Not applicable
In a stock AutoCAD drawing from acad.dwt, there is no block assigned to DIMBLK or DIMLDRBLK, and their values in the default 'Standard' dimstyle are ObjectId.Null.

If you are creating a new dimstyle, and want to use an existing dimension style as a 'template' (just as AutoCAD's DIMSTYLE dialog does), then you open the DimStyleTableRecord for the existing style you want to use as a template, and copy the values of its properties to the corresponding properties of the new dimstyle.

So, you have to get the existing DimStyleTableRecord for the existing style that uses the blocks that you want to use in the new style, and use those values, and you don't need to know their names to start with.

--

http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"C Witt" wrote in message news:6096363@discussion.autodesk.com...
I have already done the simple (like inserting a block). my problem
here (from what i can see) is that i don't KNOW the block names...? All
I can get from the help files is what to enter to get default values
(they don't give the "names").

I've even tried to extract the names from the preset values of existing
dimstyles (that didn't work either.. or perhaps i did that wrong)


as to the Has() method.. we know the block exists (as it's the default
setting for AutoCAD), so that does not help me at all..

Tony Tanzillo wrote:
> The basic problem is that you're not familiar enough with
> the API at the most basic levels (e.g., getting the Objectid
> of a block given its name is a fairly basic concept).
>
> If this is a learning exercise, you're getting ahead of yourself
> and should probably try something simpler (like inserting a
> block in the drawing, which also requires you to do the basic
> lookup of the block's ObjectId). You can find a lot of code
> here that shows how to get the ObjectId of a block. There
> may also be some code in the API samples, but I can't say
> for sure.
>
> The short and skinny is that you have to open the block
> table using GetObject(), and then call its Has() method
> to see if the block exists. If it does, then you use:
>
> blockTableObject[blockname];
>
> which returns the ObjectId of the block whose name is
> given as blockname.
>
0 Likes
Message 6 of 15

Anonymous
Not applicable
I'll give it another try..

Tony Tanzillo wrote:
> In a stock AutoCAD drawing from acad.dwt, there is no block assigned to DIMBLK or DIMLDRBLK, and their values in the default 'Standard' dimstyle are ObjectId.Null.
>
> If you are creating a new dimstyle, and want to use an existing dimension style as a 'template' (just as AutoCAD's DIMSTYLE dialog does), then you open the DimStyleTableRecord for the existing style you want to use as a template, and copy the values of its properties to the corresponding properties of the new dimstyle.
>
> So, you have to get the existing DimStyleTableRecord for the existing style that uses the blocks that you want to use in the new style, and use those values, and you don't need to know their names to start with.
>
0 Likes
Message 7 of 15

Anonymous
Not applicable
ok, after a lot more testing I finally have it working.. IF that
setting has already been used in the target drawing..

My problem now is that I need a way of setting dimblk to "_ArchTick" in
a drawing that has never had it used.. suggestions?


Tony Tanzillo wrote:
> In a stock AutoCAD drawing from acad.dwt, there is no block assigned to DIMBLK or DIMLDRBLK, and their values in the default 'Standard' dimstyle are ObjectId.Null.
>
> If you are creating a new dimstyle, and want to use an existing dimension style as a 'template' (just as AutoCAD's DIMSTYLE dialog does), then you open the DimStyleTableRecord for the existing style you want to use as a template, and copy the values of its properties to the corresponding properties of the new dimstyle.
>
> So, you have to get the existing DimStyleTableRecord for the existing style that uses the blocks that you want to use in the new style, and use those values, and you don't need to know their names to start with.
>
0 Likes
Message 8 of 15

Anonymous
Not applicable
Setting the DIMBLK system variable, or the property of a DIMSTYLE?


--

http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"C Witt" wrote in message news:6098058@discussion.autodesk.com...
ok, after a lot more testing I finally have it working.. IF that
setting has already been used in the target drawing..

My problem now is that I need a way of setting dimblk to "_ArchTick" in
a drawing that has never had it used.. suggestions?


Tony Tanzillo wrote:
> In a stock AutoCAD drawing from acad.dwt, there is no block assigned to DIMBLK or DIMLDRBLK, and their values in the default 'Standard' dimstyle are ObjectId.Null.
>
> If you are creating a new dimstyle, and want to use an existing dimension style as a 'template' (just as AutoCAD's DIMSTYLE dialog does), then you open the DimStyleTableRecord for the existing style you want to use as a template, and copy the values of its properties to the corresponding properties of the new dimstyle.
>
> So, you have to get the existing DimStyleTableRecord for the existing style that uses the blocks that you want to use in the new style, and use those values, and you don't need to know their names to start with.
>
0 Likes
Message 9 of 15

Anonymous
Not applicable
Given that is what i'm trying to do.. (in the dimstyle record object)...



Tony Tanzillo wrote:
> Setting the DIMBLK system variable, or the property of a DIMSTYLE?
>
>
0 Likes
Message 10 of 15

Anonymous
Not applicable
If the block already exists in the drawing, you just need
to get its ObjectId, by opening the block table and using
the indexer:

blockTableObject["_ArchTick"];


--

http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"C Witt" wrote in message news:6098365@discussion.autodesk.com...
Given that is what i'm trying to do.. (in the dimstyle record object)...



Tony Tanzillo wrote:
> Setting the DIMBLK system variable, or the property of a DIMSTYLE?
>
>
0 Likes
Message 11 of 15

Anonymous
Not applicable

right..  and I have that part done.  What I need is a way of setting it
when it's NOT in the drawing..



Work: VISTA
Ultimate x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs Ram,
color="#666666">GeForce 6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150





Tony Tanzillo wrote:

If the block already exists in the drawing, you just need
to get its ObjectId, by opening the block table and using
the indexer:

blockTableObject["_ArchTick"];




0 Likes
Message 12 of 15

Anonymous
Not applicable
If the block is not in the drawing, you have to insert it.

--

http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"C Witt" wrote in message news:6098560@discussion.autodesk.com...
right.. and I have that part done. What I need is a way of setting it when it's NOT in the drawing..


Work: VISTA Ultimate x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs Ram, GeForce 6800GS 256MB
Home: VISTA Ultimate x64 - AMD 64 Quad Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB
Laptop (17" HP): VISTA Premium x32 - AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram, Nvidia GeForce 6150


Tony Tanzillo wrote:
If the block already exists in the drawing, you just need
to get its ObjectId, by opening the block table and using
the indexer:

blockTableObject["_ArchTick"];
0 Likes
Message 13 of 15

Anonymous
Not applicable

I was hoping there was a way of making AutoCAD do that on it's own..
given it's just "another setting" for dimstyles (one that comes with
cad)..



But I guess not.



Work: VISTA
Ultimate x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs Ram,
color="#666666">GeForce 6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150





Tony Tanzillo wrote:

If the block is not in the drawing, you have to insert it.



0 Likes
Message 14 of 15

Anonymous
Not applicable
Just put the block in the template you use to start with.

--

http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"C Witt" wrote in message news:6098647@discussion.autodesk.com...
I was hoping there was a way of making AutoCAD do that on it's own.. given it's just "another setting" for dimstyles (one that comes with cad)..

But I guess not.


Work: VISTA Ultimate x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs Ram, GeForce 6800GS 256MB
Home: VISTA Ultimate x64 - AMD 64 Quad Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB
Laptop (17" HP): VISTA Premium x32 - AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram, Nvidia GeForce 6150


Tony Tanzillo wrote:
If the block is not in the drawing, you have to insert it.
0 Likes
Message 15 of 15

Anonymous
Not applicable

That would be the "nice" solution, but the primary reason for wanting
this particular functionality is so it can be run in drawings that are
not of our creation.   But I have since found a nice little snippet of
code (provided in the .NET book I have) that imports the required block
(after a little tweaking).



Thank you for the help.



Work: VISTA
Ultimate x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs Ram,
color="#666666">GeForce 6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150





Tony Tanzillo wrote:

Just put the block in the template you use to start with.



0 Likes