Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dim As Variant in VFP?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00345401
Message ID:
00345442
Vues:
21
Hi Michael,

I just made a quick test and got your code to work. I changed the array subscript references to 1 and 2:
ACAD = GETOBJECT(,"AutoCAD.Application")
ThisDrawing = ACAD.ActiveDocument

InsPt = ThisDrawing.Utility.GetPoint(, "Select Insertion Point: ")
strX = InsPt( 1 )
strY = InsPt( 2 )
Units = ThisDrawing.GetVariable("luprec")&& ' get the drawing's units precision

?strx
?stry
?Units
and it worked without a problem. I'm not sure what FormatPnt does so I can't help you there. luprec is just the current number of decimal places set for the .dwg.

Just a note, the point array has 3 items, xCoord, yCoord, zCoord. If you are inserting blocks you may want to use the zCoord as well. Also you need to check for outside the limits error, if the user is picking a point acad will handle it by itself (it'll keep prompting until they pick a point inside the limits), but if you are just inserting a block you'll need to either check first, or turn the sysvar 'limcheck' off first.

hth

>I'm trying to insert drawings into AutoCAD from VFP. Of course, there are guides for doing this stuff in VB, but not for VFP. Most of my problems are related to variable types that don't seem to be available in VFP.
>
>For example, to grab the X,Y,Z co-ordinate of a point in AutoCAD, you must:
>
>==================================================================
>Dim InsPt As Variant
>Dim strX As String, strY As String
>Dim Units As Long
>
>' Return a point using a prompt
>InsPt = ThisDrawing.Utility.GetPoint(, "Select Insertion Point: ")
>strX = InsPt(0)
>strY = InsPt(1)
>Units = ThisDrawing.GetVariable("luprec") ' get the drawing's units precision
>
>strX = FormatPnt(strX, Units) ' format the point to the drawing's units precision
>strY = FormatPnt(strY, Units)
>edXpnt.Text = strX ' display the point
>edYpnt.Text = strY
>==================================================================
>
>My question is, how do I deal with variables of type 'variant' in VFP?
>
>TIA
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform