乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 46|回复: 2

[编程交流] 是否有vla命令用于

[复制链接]

29

主题

196

帖子

168

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

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

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 13:05:59 | 显示全部楼层
吉尔索托,
 
要检查对象的可用属性和方法,请使用vlax dump object函数,
 
类似这样:
 
  1. (defun c:dump (/ ent)
  2. (if (setq ent (car (entsel)))
  3.    (vlax-dump-object
  4.      (vlax-ename->vla-object ent) t))
  5. (textscr)
  6. (princ))
回复

使用道具 举报

29

主题

196

帖子

168

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
145
发表于 2022-7-6 13:47:00 | 显示全部楼层
 
 
好的,我有一个更大的解释。。。
 
但肯定的是,这对我来说太多了。。。我想我会度过这段时间,开始工作。。。jajajja。。。
 
谢谢
 
  1. [b][font=Arial][size=4][u]Properties and Methods[/u][/size][/font][/b]
  2. [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]
  3. [font=Arial][size=3]First of all, let's have a look at defining a Property and a Method.[/size][/font]
  4. [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'.
  5. You can change an Object's characteristics by changing it's properties.
  6. Consider a radio: One property of a radio is its volume. In Visual Lisp,
  7. you might say that a radio has a 'Volume' property that you can adjust by
  8. changing its value. Assume you can set the volume of a radio from 0 to 10.
  9. If you could control a radio with Visual Lisp, you might write code in a
  10. procedure that changes the value of the 'Volume' property from 3 to 5 to
  11. make it play louder :
  12. [/size][/font][font=Arial][size=2][i](vla-put-Volume Radio 5)[/i][/size][/font][font=Arial][size=3]
  13. In addition to properties, objects have methods. Methods are part of objects
  14. just as properties are. Generally, methods are actions you want to perform,
  15. while properties are the attributes you set or retrieve. For example, you dial
  16. 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:
  17. [/size][/font][i][font=Arial][size=2](vla-Dial Telephone 3334444)
  18. [/size][/font][/i]
  19. [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]
  20. [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]
  21. [font=Arial]As you can see, all the Properties applicable to the "Line" Object are listed.[/font]
  22. [font=Arial]Be careful though, as some of these Properties are "[i]Read Only[/i]" and cannot be changed.
  23. 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]
  24. [font=Arial]Click on any of the Property hyperlinks for further information.[/font]
  25. [font=Arial]Another way of finding an Objects properties is to use the Visual Lisp function [i](vlax-dump-object)[/i].
  26. Open AutoCAD and then the Visual Lisp editor and type the following at the Console prompt :[/font]
  27. _$ (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.
  28. Note the ([i]RO[/i]) after some of the Properties. This tells you that this Property is "[i]Read Only[/i]".[/font]
  29. [img=http://www.afralisp.net/vl-gifs/pm2.gif][font=Arial]Let's have a look at the Methods pertaining to an Object.
  30. 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".
  31. As you can see, all the Methods applicable to the "Line" Object are listed.[/font]
  32. [font=Arial]Click on the "Move" method.
  33. The VBA Method for "Move" is displayed and the syntax is as follows :[/font]
  34. [font=Arial][size=2][i]object.Move Point1, Point2[/i]
  35. Object : [i]All Drawing Objects, AttributeRef. The object or objects this method applies to.[/i]
  36. Point1 : [i]Variant (three-element array of doubles); input-only. The 3D WCS coordinates specifying the first point of the move vector.[/i]
  37. 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]
  38. [font=Arial]Let's move the line we've just drawn :[/font]
  39. _$ (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]
  40. _$ (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?"
  41. [/i]
  42. Don't worry, we'll be having a look at that on the next page.[/font]
  43. [font=Arial]Before we go there, here's a little application that will dump all Properties and Methods for selected Objects :[/font]
  44. [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.......
  45. [/size][/font]
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-5 05:58 , Processed in 0.351624 second(s), 58 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表