gilsoto13 发表于 2022-7-6 12:31:03

是否有vla命令用于

正如你们中的一些人所知道的,我在Autolisp和visual lisp中都是无名小卒,但现在我有了另一项任务来更新许多标准块。。。我想尝试一个很好的Lisp程序,吉勒尚图刚刚分享给我们,以检查我是否可以花更少的时间来完成它。。。也许有人能帮上忙。。。我想我可以找到一种方法来改变lisp,在这种情况下,把我们所有的块都变成非注释性的。。。我想消除我们街区的属性,因为它们不应该在我的公司中使用。我在之前添加了属性,因为我认为有必要在工具选项板中使用辅助比例=Dimscale的块,所以在我将其设置为注释性后,我们有机会在工具选项板图标处更改此选项。。但现在我可以看出这是没有必要的,我想通过在图形中重新定义块来摆脱块中的注释性属性,而不必wblock,更改annotativedwg=0并重新插入到图形中。。。
 
我基本上需要知道的是,这个变量是否可以使用vla。。。像单位。。。
 
vla获取单位
vla获取单位格式
vla获取单元类型
 
vla put单位
vla put UnitsFormat格式
 
注释性属性或注释性工作组是否有vla命令?

Lee Mac 发表于 2022-7-6 13:05:59

吉尔索托,
 
要检查对象的可用属性和方法,请使用vlax dump object函数,
 
类似这样:
 

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

gilsoto13 发表于 2022-7-6 13:47:00

 
 
好的,我有一个更大的解释。。。
 
但肯定的是,这对我来说太多了。。。我想我会度过这段时间,开始工作。。。jajajja。。。
 
谢谢
 

Properties and Methods

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.
First of all, let's have a look at defining a Property and a Method.
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 :

(vla-put-Volume Radio 5)

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:

(vla-Dial Telephone 3334444)

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.
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".
As you can see, all the Properties applicable to the "Line" Object are listed.
Be careful though, as some of these Properties are "Read Only" 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.
Click on any of the Property hyperlinks for further information.
Another way of finding an Objects properties is to use the Visual Lisp function (vlax-dump-object).

Open AutoCAD and then the Visual Lisp editor and type the following at the Console prompt :
_$ (vl-load-com)_$ (setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))#<VLA-OBJECT IAcadDocument 00b94e14>_$ (setq mspace (vla-get-modelspace acadDocument))#<VLA-OBJECT IAcadModelSpace 01e42494>_$ (setq apt (getpoint "Specify First Point: "))(228.279 430.843 0.0)_$ (setq pt (getpoint "Specify next point: " apt))(503.866 538.358 0.0)_$ (setq myline (vla-addline mspace (vlax-3d-point apt)(vlax-3d-point pt)))#<VLA-OBJECT IAcadLine 01e84614>_$ (vlax-dump-object myline); 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 = -1The (vlax-dump object) function lists all the available properties for a particular Object.
Note the (RO) after some of the Properties. This tells you that this Property is "Read Only".

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.
Click on the "Move" method.
The VBA Method for "Move" is displayed and the syntax is as follows :
object.Move Point1, Point2

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

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

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

Let's move the line we've just drawn :
_$ (setq apt2 (getpoint "Specify Base Point: "))(220.911 526.575 0.0)_$ (setq pt2 (getpoint "Specify second point: " apt2))(383.02 617.889 0.0)_$ (vla-move myline (vlax-3d-point apt2)(vlax-3d-point pt2))      Now let's "dump" the Object, but this time we'll use the "T" flag to display the Objects Methods as well as it's Properties.
_$ (vlax-dump-object myline T); 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 ()"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?"

Don't worry, we'll be having a look at that on the next page.
Before we go there, here's a little application that will dump all Properties and Methods for selected Objects :
;coding starts here(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);coding ends hereOn the next page we'll have a look at how we call Property and Method Functions. See you there.......
页: [1]
查看完整版本: 是否有vla命令用于