Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP9 with Autocad
Message
From
21/02/2010 20:03:17
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01450104
Message ID:
01450158
Views:
88
Below is an example of automation with VFP (limited) that I found and saved some time ago. Not very much but you can view the full object model via the Object Browser in VFP:
goACAD = CREATEOBJECT("AutoCAD.Application")
goACAD.Visible = .T.

DIMENSION laXCoord(3) AS Double
laXCoord(1) = 10
laXCoord(2) = 20
laXCoord(3) = 0

goacad.ActiveDocument.ModelSpace.AddCircle(@laXCoord, 10)

*-* In the other direction, you can find objects in your
*-* drawing and change them. An example to find a block and
*-* change two attributes.

FOR EACH loItem IN loACAD.ActiveDocument.PaperSpace
  IF loItem.ObjectName = "AcDbBlockReference"
    IF UPPER(loItem.Name) = "MYBLOCK"
      laAttributes = loItem.GetAttributes
      FOR n = 1 TO ALEN(laAttributes, 1)
        DO CASE
          CASE laAttributes(n).TagString = "NAME"
            laAttributes(n).TextString = "blabla"
          CASE laAttributes(n).TagString = "FILE"
            laAttributes(n).TextString = ALLTRIM(THISFORM.cBestand)
        ENDCASE
      ENDFOR
      EXIT
    ENDIF
  ENDIF
ENDFOR
Previous
Reply
Map
View

Click here to load this message in the networking platform