Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help converting VBA to VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00293109
Message ID:
00293897
Vues:
32
Thanks Roi (nice photo). VFP is getting hung up on the attribs=Entity.GetAttributes line, claiming an Ole Unknown Name error. I feel I'm really getting close .... can you help with this?

I see you've avoided the varients issue altogether by selecting everything - which is OK with me for now....

TIA

>Hi Michael,
>
>Got this much for you. I couldn't quite get the parameter list for the SelectionSet.Select method worked out. You need to filter for only "INSERTS" for the for loop to not bail on entities without an attribute.
>
>You may want to hop on over to AutoDesk's web page and look for their professional networking newsgroups. There should be an .AutoCad14.Customization.VBA group there. I'd post a question about the select in there.
>
>Also, I couldn't find a list in help of the values of the constants. You may want to ask about that as well. (I guessed on the acSelectionSetAll).
>
>IAC, hope this helps.
>
>ACAD = GETOBJECT(,"AutoCAD.Application")
>DOC = ACAD.ActiveDocument
>
>** create a new selection set
>ssnew = DOC.SelectionSets.ADD("NEWSS")
>
>** create the filter list. Translates to:
>** '((0 . "INSERT")(2 . "DOOR")) ;only 'inserts' named 'door'.
>DIME aKey[2]
>DIME aVal[2]
>aKey[1] = 0
>aVal[1] = "INSERT"
>aKey[2] = 2
>aVal[2] = "DOOR"
>
>acSelectSetAll = 5 && I guessed at this. ACAD help does list the contstant value
>
>ssnew.SELECT(acSelectSetAll, aKey, aVal)
>
>** NOTE: this blows up because I couldn't figure out the correct syntax
>** for the select method. (It's currently grabbing anything in the drawing
>
>** Spin through the selset
>FOR EACH Entity IN ssnew
>	attribs = Entity.GetAttributes
>	** spin through the attribute collection of the insert.
>	FOR I = 1 TO ALEN(attribs)
>		? attribs(I).TagString + "=" + attribs(I).TextString
>	NEXT
>NEXT
>
>**----
>;;;In case you are interested, here is the equivalent autolisp code:
>(defun c:PrintAttributes (/ SSdor nLength n EntName ent_nxt sub_lst tag val)
>	(setq SSdoor (ssget "x" '((0 . "INSERT") (2 . "DOOR"))))
>	(setq nLength (sslength SSdoor))
>	(setq n 0)
>
>	(repeat	nLength
>		(setq EntName (ssname ssDoor n))
>		(setq ent_nxt (entnext EntName))
>		(setq sub_lst (cdr (assoc 0 (entget ent_nxt))))
>
>		(while (= sub_lst "ATTRIB")
>
>			(setq att_lst (entget ent_nxt))
>			(setq tag (cdr (assoc 2 att_lst)))
>			(setq val (cdr (assoc 1 att_lst)))
>			(princ (strcat "\n" tag))
>			(princ (strcat "\n" val))
>
>			(setq ent_nxt (entnext ent_nxt))
>			(setq sub_lst (cdr (assoc 0 (entget ent_nxt))))
>
>		) ;_ end of while
>		(setq n (1+ n))
>		(princ)
>	) ;_ end of repeat
>) ;_ end of defun
>
Kogo Michael Hogan

"Pinky, are you pondering what I'm pondering?"
I think so Brain, but "Snowball for Windows"?

Ideate Web Site
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform