BlockInsert Method

BlockInsert Method

Anonymous
Not applicable
259 Views
3 Replies
Message 1 of 4

BlockInsert Method

Anonymous
Not applicable
I am pretty new to customizing Acad 2000 and need some advise with a couple
of things.

I am making a tiny application for setting up a new drawing. The user will
select papersize, scale, title-field etc and the new drawing will then be
created. This works just fine until the part where I would like to insert
(and scale) the title-field (external .dwg-file). The error-message is:

Run-time error '-2145320939 (80210015)'
Invalid argument Zscale in InsertBlock

The actual code that generates the error looks like this:

============================
' Create a title in model space
If chkTitle.Value = True Then
insertionPnt(0) = iLimitX
insertionPnt(1) = 0
insertionPnt(2) = 0
sTitleField = "K:\Tf_ke-3.dwg"
Set blockObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt,
sTitleField, dScale, dScale, 0#, 0)
End If
============================
All variables are declared. dScale is a double, and has values upon
inspection.

One other thing I just remembered. How can I access the properties connected
with the 'Drawing Units' dialog (_units-command). Specifically I would like
to programmatically alter the 'Precision'-property.

Any advise are welcome!

-Morten
0 Likes
260 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
After a while I realised that Zscale has to be '1', but now I get another
message:

Run-time error '13':
Type mismatch

The code looks like this:

=============================
' Create a title in model space
If chkTitle.Value = True Then
insertionPnt(0) = CDbl(iLimitX)
insertionPnt(1) = 0#
insertionPnt(2) = 0#
sTitleField = "K:\Tf_ke-3.dwg"
Set blockObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt,
sTitleField, dScale, dScale, 1#, 0#)
End If
=============================

Any clues?

Morten

Morten Sandseth wrote in message
news:[email protected]...
> I am pretty new to customizing Acad 2000 and need some advise with a
couple
> of things.
>
> I am making a tiny application for setting up a new drawing. The user will
> select papersize, scale, title-field etc and the new drawing will then be
> created. This works just fine until the part where I would like to insert
> (and scale) the title-field (external .dwg-file). The error-message is:
>
> Run-time error '-2145320939 (80210015)'
> Invalid argument Zscale in InsertBlock
>
> The actual code that generates the error looks like this:
>
> ============================
> ' Create a title in model space
> If chkTitle.Value = True Then
> insertionPnt(0) = iLimitX
> insertionPnt(1) = 0
> insertionPnt(2) = 0
> sTitleField = "K:\Tf_ke-3.dwg"
> Set blockObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt,
> sTitleField, dScale, dScale, 0#, 0)
> End If
> ============================
> All variables are declared. dScale is a double, and has values upon
> inspection.
>
> One other thing I just remembered. How can I access the properties
connected
> with the 'Drawing Units' dialog (_units-command). Specifically I would
like
> to programmatically alter the 'Precision'-property.
>
> Any advise are welcome!
>
> -Morten
>
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
I finally found out what I had done. I had assigned a variable to AcadBlock
instead of AcadBlockReference. Sorry about that!

Dim blockObj As AcadBlock
Dim blockRefObj As AcadBlockReference

Anyway, I still would appreciate any help on the matter of the 'Drawing
Units' dialog.

Morten

Morten Sandseth wrote in message
news:[email protected]...
> After a while I realised that Zscale has to be '1', but now I get another
> message:
>
> Run-time error '13':
> Type mismatch
>
> The code looks like this:
>
> =============================
> ' Create a title in model space
> If chkTitle.Value = True Then
> insertionPnt(0) = CDbl(iLimitX)
> insertionPnt(1) = 0#
> insertionPnt(2) = 0#
> sTitleField = "K:\Tf_ke-3.dwg"
> Set blockObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt,
> sTitleField, dScale, dScale, 1#, 0#)
> End If
> =============================
>
> Any clues?
>
> Morten
>
> Morten Sandseth wrote in message
> news:[email protected]...
> > I am pretty new to customizing Acad 2000 and need some advise with a
> couple
> > of things.
> >
> > I am making a tiny application for setting up a new drawing. The user
will
> > select papersize, scale, title-field etc and the new drawing will then
be
> > created. This works just fine until the part where I would like to
insert
> > (and scale) the title-field (external .dwg-file). The error-message is:
> >
> > Run-time error '-2145320939 (80210015)'
> > Invalid argument Zscale in InsertBlock
> >
> > The actual code that generates the error looks like this:
> >
> > ============================
> > ' Create a title in model space
> > If chkTitle.Value = True Then
> > insertionPnt(0) = iLimitX
> > insertionPnt(1) = 0
> > insertionPnt(2) = 0
> > sTitleField = "K:\Tf_ke-3.dwg"
> > Set blockObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt,
> > sTitleField, dScale, dScale, 0#, 0)
> > End If
> > ============================
> > All variables are declared. dScale is a double, and has values upon
> > inspection.
> >
> > One other thing I just remembered. How can I access the properties
> connected
> > with the 'Drawing Units' dialog (_units-command). Specifically I would
> like
> > to programmatically alter the 'Precision'-property.
> >
> > Any advise are welcome!
> >
> > -Morten
> >
> >
>
>
0 Likes
Message 4 of 4

Anonymous
Not applicable
I can see that you have solved your Block problem yourself.

If you want to set PRECISION, then you have to use:

To set the value:
Thisdrawing.setvariable ("LUPREC"), For "Length" precision
and
Thisdrawing.setvariable ("AUPREC"), For "Angle" precision

To read the value:
Thisdrawing.getvariable ("LUPREC"), For "Length" precision
and
Thisdrawing.getvariable ("AUPREC"), For "Angle" precision

Good luck.

Lars Gaarde

On Mon, 04 Oct 1999 12:43:21 GMT, "Morten Sandseth"
wrote:

>I finally found out what I had done. I had assigned a variable to AcadBlock
>instead of AcadBlockReference. Sorry about that!
>
>Dim blockObj As AcadBlock
>Dim blockRefObj As AcadBlockReference
>
>Anyway, I still would appreciate any help on the matter of the 'Drawing
>Units' dialog.
>
>Morten
>
>Morten Sandseth wrote in message
>news:[email protected]...
>> After a while I realised that Zscale has to be '1', but now I get another
>> message:
>>
>> Run-time error '13':
>> Type mismatch
>>
>> The code looks like this:
>>
>> =============================
>> ' Create a title in model space
>> If chkTitle.Value = True Then
>> insertionPnt(0) = CDbl(iLimitX)
>> insertionPnt(1) = 0#
>> insertionPnt(2) = 0#
>> sTitleField = "K:\Tf_ke-3.dwg"
>> Set blockObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt,
>> sTitleField, dScale, dScale, 1#, 0#)
>> End If
>> =============================
>>
>> Any clues?
>>
>> Morten
>>
>> Morten Sandseth wrote in message
>> news:[email protected]...
>> > I am pretty new to customizing Acad 2000 and need some advise with a
>> couple
>> > of things.
>> >
>> > I am making a tiny application for setting up a new drawing. The user
>will
>> > select papersize, scale, title-field etc and the new drawing will then
>be
>> > created. This works just fine until the part where I would like to
>insert
>> > (and scale) the title-field (external .dwg-file). The error-message is:
>> >
>> > Run-time error '-2145320939 (80210015)'
>> > Invalid argument Zscale in InsertBlock
>> >
>> > The actual code that generates the error looks like this:
>> >
>> > ============================
>> > ' Create a title in model space
>> > If chkTitle.Value = True Then
>> > insertionPnt(0) = iLimitX
>> > insertionPnt(1) = 0
>> > insertionPnt(2) = 0
>> > sTitleField = "K:\Tf_ke-3.dwg"
>> > Set blockObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt,
>> > sTitleField, dScale, dScale, 0#, 0)
>> > End If
>> > ============================
>> > All variables are declared. dScale is a double, and has values upon
>> > inspection.
>> >
>> > One other thing I just remembered. How can I access the properties
>> connected
>> > with the 'Drawing Units' dialog (_units-command). Specifically I would
>> like
>> > to programmatically alter the 'Precision'-property.
>> >
>> > Any advise are welcome!
>> >
>> > -Morten
>> >
>> >
>>
>>
>
0 Likes