Jump to content

Is there a vla- command for annotativedwg variable?


gilsoto13

Recommended Posts

As some of you know, I am just nobody in Autolisp nor visual lisp, but now I got another task to update lots of standard blocks... I want to try a nice lisp that Gilles Chanteau just shared to us, to check if I can take less time to finish it... maybe someone can help out with this... I think I can find the way to change the lisp for this case to change all of our blocks to be non-annotative... I want to eliminate that property of our blocks, because they are not supposed to be used in my company. I added the property before cause I thought it was necessary to use the blocks in tool palettes with auxiliary scale= Dimscale, so after I made them annotative we had the chance to change this option at the tool palette icons.. but now I can see it's not necessary and I want to get rid of annotative property in our blocks by redefining them inside a drawing without having to wblock, change the annotativedwg=0 and reinsert into the drawing...

 

What I need basically is to know if this variable can be get and put using vla... like units...

 

vla-get-Units

vla-get-UnitsFormat

vla-get-UnitsType

 

vla-put-Units

vla-put-UnitsFormat

 

Is there a vla command for annotative property or annotativedwg?

Link to comment
Share on other sites

Gilsoto,

 

To check the properties and methods available for an object, use the vlax-dump-object function,

 

something like this:

 

(defun c:dump (/ ent)
 (if (setq ent (car (entsel)))
   (vlax-dump-object
     (vlax-ename->vla-object ent) t))
 (textscr)
 (princ))

Link to comment
Share on other sites

Gilsoto,

 

To check the properties and methods available for an object, use the vlax-dump-object function,

 

something like this:

 

(defun c:dump (/ ent)
 (if (setq ent (car (entsel)))
   (vlax-dump-object
     (vlax-ename->vla-object ent) t))
 (textscr)
 (princ))

 

 

ok, I have a little bigger explanation of this...

 

But definitively it's too much programation for me... I think I will just pass this time and get to work... jajajja...

 

thanks

 

[b][font=Arial][size=4][u]Properties and Methods[/u][/size][/font][/b]

[font=Arial][size=3]The aim of this tutorial is not to describe the Properties and Methods of every AutoCAD Object, but rather to show you, first how to find the Properties and Methods available for an Object, and secondly to describe the usage of such Property or Method within Visual Lisp. Each Object within AutoCAD has numerous Properties and Methods which differ from Object to Object. To attempt to list each Property or Method for each Object is way beyond the scope of this tutorial.[/size][/font]
[font=Arial][size=3]First of all, let's have a look at defining a Property and a Method.[/size][/font]
[font=Arial][size=3]Visual Lisp Objects support properties and methods,  In Visual Lisp, an Object's data (settings or attributes) are called 'properties', while the various procedures that can operate on an Object are called it's 'methods'.

You can change an Object's characteristics by changing it's properties.
Consider a radio: One property of a radio is its volume. In Visual Lisp,
you might say that a radio has a 'Volume' property that you can adjust by
changing its value. Assume you can set the volume of a radio from 0 to 10.
If you could control a radio with Visual Lisp, you might write code in a
procedure that changes the value of the 'Volume' property from 3 to 5 to
make it play louder :

[/size][/font][font=Arial][size=2][i](vla-put-Volume Radio 5)[/i][/size][/font][font=Arial][size=3]

In addition to properties, objects have methods. Methods are part of objects
just as properties are. Generally, methods are actions you want to perform,
while properties are the attributes you set or retrieve. For example, you dial
a telephone to make a call. You might say that telephones have a 'Dial' method, and you could use this syntax to dial a seven digit number 3334444:

[/size][/font][i][font=Arial][size=2](vla-Dial Telephone 3334444)
[/size][/font][/i]
[font=Arial][img=http://www.afralisp.net/vl-gifs/pm1.gif]Before you can start to change an Objects Properties or Methods, you need to know what Properties and Methods are available to the particular Object. There are a couple of ways of going about this. First we'll look at Properties.[/font]
[font=Arial]Under AutoCAD Help, open "Visual Lisp and AutoLisp" and then "ActiveX and VBA Reference". Choose the "Objects" sub-section and from the list choose the Object whose Properties you would like list. Choose "Line".[/font]
[font=Arial]As you can see, all the Properties applicable to the "Line" Object are listed.[/font]
[font=Arial]Be careful though, as some of these Properties are "[i]Read Only[/i]" and cannot be changed.
e.g. The "Angle" property is "Read Only." Think about it, if you changed the "ANGLE" Property, the Start or End point of the Line Object would have to change as well.[/font]
[font=Arial]Click on any of the Property hyperlinks for further information.[/font]
[font=Arial]Another way of finding an Objects properties is to use the Visual Lisp function [i](vlax-dump-object)[/i].

Open AutoCAD and then the Visual Lisp editor and type the following at the Console prompt :[/font]
_$ (vl-load-com)_$ (setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))[color=#ff0000]#<VLA-OBJECT IAcadDocument 00b94e14>[/color]_$ (setq mspace (vla-get-modelspace acadDocument))[color=#ff0000]#<VLA-OBJECT IAcadModelSpace 01e42494>[/color]_$ (setq apt (getpoint "Specify First Point: "))[color=#ff0000](228.279 430.843 0.0)[/color]_$ (setq pt (getpoint "Specify next point: " apt))[color=#ff0000](503.866 538.358 0.0)[/color]_$ (setq myline (vla-addline mspace (vlax-3d-point apt)(vlax-3d-point pt)))[color=#ff0000]#<VLA-OBJECT IAcadLine 01e84614>[/color]_$ (vlax-dump-object myline)[color=#ff0000]; IAcadLine: AutoCAD Line Interface; Property values:;   Angle (RO) = 0.371971;   Application (RO) = #<VLA-OBJECT IAcadApplication 00adc088>;   Color = 256;   Delta (RO) = (275.587 107.515 0.0);   Document (RO) = #<VLA-OBJECT IAcadDocument 00b94e14>;   EndPoint = (503.866 538.358 0.0);   Handle (RO) = "958";   HasExtensionDictionary (RO) = 0;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 01e84564>;   Layer = "7";   Length (RO) = 295.817;   Linetype = "BYLAYER";   LinetypeScale = 1.0;   Lineweight = -1;   Normal = (0.0 0.0 1.0);   ObjectID (RO) = 25187840;   ObjectName (RO) = "AcDbLine";   OwnerID (RO) = 25186496;   PlotStyleName = "ByLayer";   StartPoint = (228.279 430.843 0.0);   Thickness = 0.0;   Visible = -1[/color][font=Arial]The (vlax-dump object) function lists all the available properties for a particular Object.
Note the ([i]RO[/i]) after some of the Properties. This tells you that this Property is "[i]Read Only[/i]".[/font]

[img=http://www.afralisp.net/vl-gifs/pm2.gif][font=Arial]Let's have a look at the Methods pertaining to an Object.
Under AutoCAD help, open "Visual Lisp and AutoLisp" and then "ActiveX and VBA Reference". Again, choose the "Objects" sub-section and from the list choose the Object whose Methods you would like list. Choose "Line".
As you can see, all the Methods applicable to the "Line" Object are listed.[/font]
[font=Arial]Click on the "Move" method.
The VBA Method for "Move" is displayed and the syntax is as follows :[/font]
[font=Arial][size=2][i]object.Move Point1, Point2[/i]

Object : [i]All Drawing Objects, AttributeRef. The object or objects this method applies to.[/i]

Point1 : [i]Variant (three-element array of doubles); input-only. The 3D WCS coordinates specifying the first point of the move vector.[/i]

Point2 : [i]Variant (three-element array of doubles); input-only. The 3D WCS coordinates specifying the second point of the move vector.[/i][/size][/font]

[font=Arial]Let's move the line we've just drawn :[/font]
_$ (setq apt2 (getpoint "Specify Base Point: "))[color=#ff0000](220.911 526.575 0.0)[/color]_$ (setq pt2 (getpoint "Specify second point: " apt2))[color=#ff0000](383.02 617.889 0.0)[/color]_$ (vla-move myline (vlax-3d-point apt2)(vlax-3d-point pt2))        [font=Arial]Now let's "dump" the Object, but this time we'll use the "[i]T[/i]" flag to display the Objects Methods as well as it's Properties.[/font]
_$ (vlax-dump-object myline T)[color=#ff0000]; IAcadLine: AutoCAD Line Interface; Property values:;   Angle (RO) = 5.60729;   Application (RO) = #<VLA-OBJECT IAcadApplication 00adc088>;   Color = 256;   Delta (RO) = (246.112 -197.356 0.0);   Document (RO) = #<VLA-OBJECT IAcadDocument 00b94e14>;   EndPoint = (629.133 420.533 0.0);   Handle (RO) = "957";   HasExtensionDictionary (RO) = 0;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 01e84574>;   Layer = "7";   Length (RO) = 315.469;   Linetype = "BYLAYER";   LinetypeScale = 1.0;   Lineweight = -1;   Normal = (0.0 0.0 1.0);   ObjectID (RO) = 25187832;   ObjectName (RO) = "AcDbLine";   OwnerID (RO) = 25186496;   PlotStyleName = "ByLayer";   StartPoint = (383.02 617.889 0.0);   Thickness = 0.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);   Offset (1);   Rotate (2);   Rotate3D (3);   ScaleEntity (2);   SetXData (2);   TransformBy (1);   Update ()[/color][font=Arial][i]"But, the syntax of the "Move" method you used in Visual Lisp, is different from the VBA syntax!! How do I know how to call the function in Visual Lisp?"
[/i]
Don't worry, we'll be having a look at that on the next page.[/font] 
[font=Arial]Before we go there, here's a little application that will dump all Properties and Methods for selected Objects :[/font]
[i][font=Arial][size=2][color=#008000];coding starts here[/color][/size][/font][font=Arial](defun C:HaveaDump ( / ent)  (vl-load-com)    (while        (setq ent (entsel))        (vlax-dump-object (vlax-Ename->Vla-Object (car ent)) T)         );while   (princ));defun(princ)[/font][/i][font=Arial][color=#008000][i];coding ends here[/i][/color][/font][font=Arial][size=3]On the next page we'll have a look at how we call Property and Method Functions. See you there.......
[/size][/font]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...