RECOGNIZING FUNCTIONS.......

RECOGNIZING FUNCTIONS.......

vishshreevT578L
Advocate Advocate
1,113 Views
8 Replies
Message 1 of 9

RECOGNIZING FUNCTIONS.......

vishshreevT578L
Advocate
Advocate

WELL! THANKS IN ADVANCE THOUGH IT NEVER HAPPENS THAT I DONT GET A SOLUTION HERE

MY RECENT QUERRY IS ABOUT RECOGNIZING WHICH FUNCTION TO BE USE..

FOR INSTANCE

I MADE A STRING OF MYNAME AS A "SHREEV"

 

 

 

BY THE INSPECT WINDOW I COME TO KNOW IT IS A STRING OR I AM WELL AWARE WITH A STRING I CAN USE ALL FUNCTIONS TO MANIPULATE THIS STRING.

 

BUT WHAT IN CASE OF SYMBOL,,APPLICATION,,FUNCTION,,OBJECT,,ETC..HOW WILL I COME TO KNOW WHEN TO USE WHICH FUNCTION

Shreev
0 Likes
Accepted solutions (1)
1,114 Views
8 Replies
Replies (8)
Message 2 of 9

SeeMSixty7
Advisor
Advisor
Accepted solution
You can use the TYPE function.

(type (vlax-get-acad-object))
VLA-OBJECT

(type 1.0)
REAL

(type 1)
INT

(type "SHREEV")
STR

Hope that helps
0 Likes
Message 3 of 9

vishshreevT578L
Advocate
Advocate
THANX SIR
Shreev
0 Likes
Message 4 of 9

SeeMSixty7
Advisor
Advisor
You are welcome!
0 Likes
Message 5 of 9

john.uhden
Mentor
Mentor

Also, with Visual Lisp objects you can use (vlax-dump-object object 1) to see all the properties and methods that are applicable to the object.

 

For example:

 

Command: (setq e (car (entsel)))

Select object: <Entity name: 40082d88> ;; I selected a piece of text

Command: (setq object (vlax-ename->vla-object e))
#<VLA-OBJECT IAcadText 0262de44>

Command: (vlax-dump-object object 1)
; IAcadText: AutoCAD Text Interface
; Property values:
;   Alignment = 0
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00a8a730>
;   Backward = 0
;   Color = 256
;   Document (RO) = #<VLA-OBJECT IAcadDocument 02596f8c>
;   Handle (RO) = "31"
;   HasExtensionDictionary (RO) = 0
;   Height = 0.2
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0262dc94>
;   InsertionPoint = (8.67437 3.76485 0.0)
;   Layer = "0"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 1074277768
;   ObjectName (RO) = "AcDbText"
;   ObliqueAngle = 0.0
;   OwnerID (RO) = 1074277624
;   PlotStyleName = "ByLayer"
;   Rotation = 0.0
;   ScaleFactor = 1.0
;   StyleName = "Standard"
;   TextAlignmentPoint = (0.0 0.0 0.0)
;   TextGenerationFlag = 0
;   TextString = "This is TEXT."
;   Thickness = 0.0
;   UpsideDown = 0
;   Visible = -1
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   Delete ()
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()

Note that some of the properties are noted as (RO) which means "Read Only" and cannot be modified.

ost of the methods have a number in parentheses after them.  That number represents the number of arguments the method requires (in addition to the object itself).

 

Fore example, to get the Lower Left (LL) and Upper Right (UR) corners of the text object:

 

Command: (vla-getboundingbox object 'LL 'UR)
nil

Command: !LL #<safearray...>

Command: !UR #<safearray...>

Command: (vlax-safearray->list LL) (8.67437 3.76485 0.0)

Command: (vlax-safearray->list UR) (10.8077 3.96485 0.0)

OR...

Command: (setq str1 (vlax-get object 'textstring)) "This is TEXT."

Command: (vlax-put object 'TextString "Are you sure?") nil

Command: (setq str2 (vlax-get object 'textstring)) "Are you sure?"

John F. Uhden

Message 6 of 9

steve_carson
Enthusiast
Enthusiast

Thanks John, I never realized until your post that the arguments to a method can be output. I always thought of arguments as being fed into a function.

 

Cool stuff!

0 Likes
Message 7 of 9

john.uhden
Mentor
Mentor
I don't remember offhand what other vlax functions take quoted symbol names and supply them with values. Maybe Help will reveal them, or maybe Trial and Error.

John F. Uhden

0 Likes
Message 8 of 9

steve_carson
Enthusiast
Enthusiast

Well after you posted I checked it out on the following linked website to see what it had to say about the arguments and noticed it showed them as "Output-only".

 

http://entercad.ru/acadauto.en/

 

 

0 Likes
Message 9 of 9

devitg
Advisor
Advisor
It also give results 


VLA-GetXData AppName, XDataType, XDataValue 


AppName

String; input-only
A NULL string will return all the data attached to the object, regardless of the application that created it. Supplying an application name will return only the data that was created by the specified application. 

XDataType

Variant (array of shorts); output-only 

XDataValue

Variant (array of variants); output-only 

0 Likes