dragmode blocks while inserting in VB

dragmode blocks while inserting in VB

Anonymous
Not applicable
411 Views
3 Replies
Message 1 of 4

dragmode blocks while inserting in VB

Anonymous
Not applicable
Hello,

I'm trying to insert a block in VB6 and want to pass XYZ scale factors to
it. The problem I'm having is that I'm using "Getpoint" for insertion point
and then the "Sendcommand" to insert the block. This works, but this method
will not allow the block to be in "Dragmode" before insertion point is
picked (like AutoCAD's normal insert command). Any ideas on how I can
resolve this?

'------example code------------

Dim blkpnt2 As Variant
Dim UCSPnt As Variant

blkpnt2 = acadDoc.Utility.GetPoint(, "Specify insertion point: ")
'forced to specify insertion point first, therfore not allowing the block to
drag
UCSPnt = acadDoc.Utility.TranslateCoordinates(blkpnt2, acWorld, acUCS,
False)

xs = xscale.Text 'custom scale setting based on block
ys = yscale.Text 'custom scale varies with block
zs = 1

acadDoc.SendCommand ".-insert" & vbCr & TESTBLOCK & vbCr & UCSPnt(0) & "," &
UCSPnt(1) & "," & UCSPnt(2) & vbCr & "XYZ" & vbCr & xs & vbCr & ys & vbCr &
zs & vbCr

'because I have to use GetPoint and TranslateCoordinates for insertion
point, I do not have the abilityt to show the block being dragged before
insertion point....


Thanks in advance!
0 Likes
412 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Hi Doug,
If you're already using sendcommand, why not just skip the getpoint
entirely and let the insert command do all the work including the
retrieval of the point. If you're concerned about the scale, you can
always grab the block later (via an event such as object added, if you
need to) and then use the blockref's scale method.
-Josh

Doug Cochran wrote:

> Hello,
>
> I'm trying to insert a block in VB6 and want to pass XYZ scale factors to
> it. The problem I'm having is that I'm using "Getpoint" for insertion point
> and then the "Sendcommand" to insert the block. This works, but this method
> will not allow the block to be in "Dragmode" before insertion point is
> picked (like AutoCAD's normal insert command). Any ideas on how I can
> resolve this?
>
> '------example code------------
>
> Dim blkpnt2 As Variant
> Dim UCSPnt As Variant
>
> blkpnt2 = acadDoc.Utility.GetPoint(, "Specify insertion point: ")
> 'forced to specify insertion point first, therfore not allowing the block to
> drag
> UCSPnt = acadDoc.Utility.TranslateCoordinates(blkpnt2, acWorld, acUCS,
> False)
>
> xs = xscale.Text 'custom scale setting based on block
> ys = yscale.Text 'custom scale varies with block
> zs = 1
>
> acadDoc.SendCommand ".-insert" & vbCr & TESTBLOCK & vbCr & UCSPnt(0) & "," &
> UCSPnt(1) & "," & UCSPnt(2) & vbCr & "XYZ" & vbCr & xs & vbCr & ys & vbCr &
> zs & vbCr
>
> 'because I have to use GetPoint and TranslateCoordinates for insertion
> point, I do not have the abilityt to show the block being dragged before
> insertion point....
>
>
> Thanks in advance!
>
>
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks Josh,

Thats an idea I haven't considered. I think what you are saying is to use
the SendCommand to perform the insertion (with Dragmode) and default to the
scale factors (1) with a VBCR, and then come back and scale the block using
"blockref's" scale method if a scale factor of other than 1 is required.
The only other problem I can think of would be the "rotation" angle, since
with sendcommand I can dragmode rotate, however the block will suddenly
scale up/down if the blockref scale method adjusts the scale after insert.
Hope that makes sense.

Thanks again for you help.


"Minkwitz Design" wrote in message
news:[email protected]...
> Hi Doug,
> If you're already using sendcommand, why not just skip the getpoint
> entirely and let the insert command do all the work including the
> retrieval of the point. If you're concerned about the scale, you can
> always grab the block later (via an event such as object added, if you
> need to) and then use the blockref's scale method.
> -Josh
>
> Doug Cochran wrote:
>
> > Hello,
> >
> > I'm trying to insert a block in VB6 and want to pass XYZ scale factors
to
> > it. The problem I'm having is that I'm using "Getpoint" for insertion
point
> > and then the "Sendcommand" to insert the block. This works, but this
method
> > will not allow the block to be in "Dragmode" before insertion point is
> > picked (like AutoCAD's normal insert command). Any ideas on how I can
> > resolve this?
> >
> > '------example code------------
> >
> > Dim blkpnt2 As Variant
> > Dim UCSPnt As Variant
> >
> > blkpnt2 = acadDoc.Utility.GetPoint(, "Specify insertion point: ")
> > 'forced to specify insertion point first, therfore not allowing the
block to
> > drag
> > UCSPnt = acadDoc.Utility.TranslateCoordinates(blkpnt2, acWorld,
acUCS,
> > False)
> >
> > xs = xscale.Text 'custom scale setting based on block
> > ys = yscale.Text 'custom scale varies with block
> > zs = 1
> >
> > acadDoc.SendCommand ".-insert" & vbCr & TESTBLOCK & vbCr & UCSPnt(0) &
"," &
> > UCSPnt(1) & "," & UCSPnt(2) & vbCr & "XYZ" & vbCr & xs & vbCr & ys &
vbCr &
> > zs & vbCr
> >
> > 'because I have to use GetPoint and TranslateCoordinates for insertion
> > point, I do not have the abilityt to show the block being dragged before
> > insertion point....
> >
> >
> > Thanks in advance!
> >
> >
> >
>
0 Likes
Message 4 of 4

Anonymous
Not applicable
Two suggestion:

Set scale and rotation angle first, something like this, may not be exact
(never tried it):
acadDoc.SendCommand ".-insert" & vbCr & TESTBLOCK & vbCr & "X " & xs & "Y "
& ys & "Z " zs & "Rotate 0 ")

or:
'insert drawing in the center of the screen using some known point, or
system variable viewctr
Set tempobj = ThisDrawing.ModelSpace.InsertBlock(pt1, testblock, xscafactor,
yscafactor, zscafactor, insangle)
AutoCAD.ActiveDocument.SendCommand ("move l @ ") 'two spaces after l

you can even:
AutoCAD.ActiveDocument.SendCommand ("rotate l @ ")




"Doug Cochran" wrote in message
news:[email protected]...
> Hello,
>
> I'm trying to insert a block in VB6 and want to pass XYZ scale factors to
> it. The problem I'm having is that I'm using "Getpoint" for insertion
point
> and then the "Sendcommand" to insert the block. This works, but this
method
> will not allow the block to be in "Dragmode" before insertion point is
> picked (like AutoCAD's normal insert command). Any ideas on how I can
> resolve this?
>
> '------example code------------
>
> Dim blkpnt2 As Variant
> Dim UCSPnt As Variant
>
> blkpnt2 = acadDoc.Utility.GetPoint(, "Specify insertion point: ")
> 'forced to specify insertion point first, therfore not allowing the block
to
> drag
> UCSPnt = acadDoc.Utility.TranslateCoordinates(blkpnt2, acWorld, acUCS,
> False)
>
> xs = xscale.Text 'custom scale setting based on block
> ys = yscale.Text 'custom scale varies with block
> zs = 1
>
> acadDoc.SendCommand ".-insert" & vbCr & TESTBLOCK & vbCr & UCSPnt(0) & ","
&
> UCSPnt(1) & "," & UCSPnt(2) & vbCr & "XYZ" & vbCr & xs & vbCr & ys & vbCr
&
> zs & vbCr
>
> 'because I have to use GetPoint and TranslateCoordinates for insertion
> point, I do not have the abilityt to show the block being dragged before
> insertion point....
>
>
> Thanks in advance!
>
>
0 Likes