Tipo166 发表于 2022-7-6 07:08:23

带VBA的夹点和无夹点

大家好,
我认为这是一个简单的一个只是需要一点光的道路上。。。。。。
 
我想突出显示并显示活动选择集中项目的夹点,这是我的位置:https://www.cadtutor.net/forum/attachment.php?attachmentid=8552&stc=1&d=1228236900
 
 

Set sset = ThisDrawing.SelectionSets.Add("SS1")
   mode = acSelectionSetLast
   sset.Select mode
   ThisDrawing.SendCommand ("_grips" & vbCr & "1" & vbCr)
   sset.Highlight True


borgunit 发表于 2022-7-6 07:43:07

从AutoCAD帮助文件示例中:
 

DisplayGrips Example Sub Example_DisplayGrips()   ' This example reads and modifies the preference value that controls   ' the display of selection set grips for the Stretch, Move, Rotate,   ' Scale, and Mirror grip modes.   ' When finished, this example resets the preference value back to   ' its original value.          Dim ACADPref As AcadPreferencesSelection   Dim originalValue As Variant, newValue As Variant          ' Get the selection preferences object   Set ACADPref = ThisDrawing.Application.preferences.Selection          ' Read and display the original value   originalValue = ACADPref.DisplayGrips   MsgBox "The DisplayGrips preference is set to: " & originalValue      ' Modify the DisplayGrips preference by toggling the value   ACADPref.DisplayGrips = Not (originalValue)   newValue = ACADPref.DisplayGrips   MsgBox "The DisplayGrips preference has been set to: " & newValue      ' Reset the preference back to its original value   '   ' * Note: Comment out this last section to leave the change to   '         this preference in effect   ACADPref.DisplayGrips = originalValue   MsgBox "The DisplayGrips preference was reset back to: " & originalValue End Sub   

Tipo166 发表于 2022-7-6 07:56:49

我使用示例代码>在首选项上放置手表>displaygrips值默认为“true”>尝试了这一点,然后我尝试打开和关闭它,逐行遍历代码,观察displaygrips值的变化等等,使用此示例代码仍然没有成功。有什么想法吗?
谢谢

mtrasi 发表于 2022-7-6 08:20:49

要显示夹点,必须在AutoCAD提示中调用SELECT命令,然后使用Lisp handent函数从VBA传递到提示图元。
我们有一些小问题http://www.abccorsicad.it/software_autocad.html但基本上你不需要下载和安装这些插件来阅读(开源)代码:只要试试这个:
'使用夹点选择图形的所有线
公共子测试()
Dim c为收藏,obj为收藏
集合c=新集合
对于本图纸中的每个obj。模型空间
如果obj的类型为AcadLine,则
c、 添加对象
如果结束
下一个
设置选择c
末端接头
 
私有子集合选择(objs作为集合)
Dim obj
如果此图纸。选择FirstSelectionSet。然后计数>0
'只需发送任何命令即可删除夹点
此图纸。SendCommand Chr(27)
如果结束
此图纸。SendCommand“_SELECT”和Chr(13)
对于obj中的每个obj
此图纸。SendCommand“(handent”“”&obj.Handle&“”“&vbCr
下一个
此图纸。SendCommand vbCr
末端接头
 
页: [1]
查看完整版本: 带VBA的夹点和无夹点