Tipo166 Posted December 2, 2008 Posted December 2, 2008 Hello All, I think this is an easy one just need a little light on the path...... I want to highlight AND show the grips of the items in my active selection set, here is where I am at: Set sset = ThisDrawing.SelectionSets.Add("SS1") mode = acSelectionSetLast sset.Select mode ThisDrawing.SendCommand ("_grips" & vbCr & "1" & vbCr) sset.Highlight True Quote
borgunit Posted December 2, 2008 Posted December 2, 2008 From the AutoCAD help file example: DisplayGrips Example [ActiveX and VBA Reference: AAR]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 Quote
Tipo166 Posted December 2, 2008 Author Posted December 2, 2008 I tried this using the example code > put a watch on the preferences > displaygrips value was defaulted to "true" > then I tried toggling it on and off, walking through the code, line by line, watching the displaygrips value change etc using this sample code still no go. Any ideas? thx Quote
mtrasi Posted December 23, 2012 Posted December 23, 2012 To show grips you must call SELECT command in AutoCAD Prompt and then pass from VBA to Prompt entities using Lisp handent function. We have some smaples in http://www.abccorsicad.it/software_autocad.html but basically you have not to download and install these plugins to read (opensource) code: just try this: 'select all lines of your drawing with grips Public Sub test() Dim c As Collection, obj As AcadEntity Set c = New Collection For Each obj In ThisDrawing.ModelSpace If TypeOf obj Is AcadLine Then c.Add obj End If Next SetSelection c End Sub Private Sub SetSelection(objs As Collection) Dim obj If ThisDrawing.PickfirstSelectionSet.Count > 0 Then 'just send any command to remove grips ThisDrawing.SendCommand Chr(27) End If ThisDrawing.SendCommand "_SELECT" & Chr(13) For Each obj In objs ThisDrawing.SendCommand "(handent """ & obj.Handle & """)" & vbCr Next ThisDrawing.SendCommand vbCr End Sub Hello All,I think this is an easy one just need a little light on the path...... I want to highlight AND show the grips of the items in my active selection set, here is where I am at: Set sset = ThisDrawing.SelectionSets.Add("SS1") mode = acSelectionSetLast sset.Select mode ThisDrawing.SendCommand ("_grips" & vbCr & "1" & vbCr) sset.Highlight True Quote
Recommended Posts
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.