Grips of a line

Grips of a line

Anonymous
Not applicable
508 Views
10 Replies
Message 1 of 11

Grips of a line

Anonymous
Not applicable
How can I display the grips of a line. I am using Acad2000 and VB 6. In VisualLISP you can use the function (sssetfirst arg1 arg2). Can anyone please help me.
0 Likes
509 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable
"dlutzow" wrote in message
news:f0a84a8.-1@WebX.maYIadrTaRb...
> How can I display the grips of a line. I am using Acad2000 and VB 6. In
VisualLISP you can use the function (sssetfirst arg1 arg2). Can anyone
please help me.

The only way to do this in VBA is by using AcadX.arx
(www.caddzone.com/acadx/acadx.htm).

You must implement your code as a command using the
AcadXEditorCommand class, and from within the command's
Execute() event handler, you can assign the selection
set containing the objects to be left gripped and
selected to the ActiveSelectionSet property of the
AcadXDrawingEditor class.

Here is a simple demo that implements a command called
VBEXPLODE, which will explode a selected LWPOLYLINE and
leave the resulting entities gripped and selected:

'---------------------------------------------------------
Public WithEvents cmdExplode As AcadXEditorCommand

Public Sub InitApplication()
Dim Editor As New AcadXDrawingEditor
Set cmdExplode = Editor.AddCommand("VBEXPLODE")
cmdExplode.Enabled = False
cmdExplode.Transparent = False
cmdExplode.NoPerspective = True
cmdExplode.RedrawPickFirst = True
cmdExplode.Enabled = True
End Sub

Private Sub cmdExplode_Execute(Context As ACADXLib.IAcadXDocumentContext)
Dim Ent As AcadEntity
Dim Pt As Variant
Dim Polyline As AcadLWPolyline
On Error GoTo Done
Context.Document.Utility.GetEntity Ent, Pt, "Select LWPolyline: "
Set Polyline = Ent
Context.Command Array("._EXPLODE", Polyline)
Dim Editor As New AcadXDrawingEditor
Editor.ActiveSelectionSet = Context.Document.ActiveSelectionSet
Done:
Err.Clear
End Sub

'---------------------------------------------------------
0 Likes
Message 3 of 11

Anonymous
Not applicable
Grab VLAX from our site. Then you can do something like this:

Public Sub setPickFirst()
Dim lispCode As VLAX
Dim oEnt As AcadEntity, dPnt() As Double

Set lispCode = New VLAX
ThisDrawing.Utility.GetEntity oEnt, dPnt, "Select object: "

lispCode.EvalLispExpression "(setq ss (ssadd))"
lispCode.EvalLispExpression "(ssadd " & _
"(handent " & Chr(34) & oEnt.Handle &
Chr(34) & ")" & _
"ss" & _
")"
lispCode.EvalLispExpression "(sssetfirst nil ss)"
lispCode.EvalLispExpression "(setq ss nil)"

Set lispCode = Nothing
End Sub

--
There's more than one way to skin a cat...
Bobby C. Jones
http://www.acadx.com
0 Likes
Message 4 of 11

Anonymous
Not applicable
>Grab VLAX from our site. Then you can do something like this:....

It doesn't work.
0 Likes
Message 5 of 11

Anonymous
Not applicable
Our site, VLAX, my code, which part are you having trouble with? All is
working well on my end...
--
Bobby C. Jones
http://www.acadx.com
0 Likes
Message 6 of 11

Anonymous
Not applicable
>> Our site, VLAX, my code, which part are you having trouble with?

I'm not having trouble with any part,
it just don't work. There's no grips
or highlighting on the line after the
macro finishes.

It is the VLAX from acadx.com, and
the code (exactly) as you just posted.

I pick the line, and nothing happens.
0 Likes
Message 7 of 11

Anonymous
Not applicable
"RudyVeritas" wrote in message
news:f0a84a8.4@WebX.maYIadrTaRb...
> > Our site, VLAX, my code, which part are you having trouble with?
> I'm not having trouble with any part,
> it just don't work. There's no grips
> or highlighting on the line after the
> macro finishes.
>
> It is the VLAX from acadx.com, and
> the code (exactly) as you just posted.
>
> I pick the line, and nothing happens.

Of course it doesn't work. It's impossible
to set the pickfirst selection set from a
VBA macro executed with VBARUN or (vl-vbarun).
It doesn't matter how you do it (via LISP or
via ARX), it still does not work. This is
because the VBA code executes in a context
where the pickfirst selection cannot be set.

Of course, if your user doesn't mind stepping
through the code in the VBA IDE.... then it
does work.

Haarrrrrrr!
0 Likes
Message 8 of 11

Anonymous
Not applicable
> Haarrrrrrr!

Touché Tony. In some cases there may be only one way to skin a cat...Until
we meet again 🙂
--
Bobby C. Jones
http://www.acadx.com
0 Likes
Message 9 of 11

Anonymous
Not applicable
I think you can overcome this limitation (not being able to use the
pickfirst selection set) by using vla-runmacro to run your macro from lisp.

Chuck

"Tony Tanzillo" wrote in message
news:4B317D5EF04176A5F9877A7D199A7F04@in.WebX.maYIadrTaRb...
> "RudyVeritas" wrote in message
> news:f0a84a8.4@WebX.maYIadrTaRb...
> > > Our site, VLAX, my code, which part are you having trouble with?
> > I'm not having trouble with any part,
> > it just don't work. There's no grips
> > or highlighting on the line after the
> > macro finishes.
> >
> > It is the VLAX from acadx.com, and
> > the code (exactly) as you just posted.
> >
> > I pick the line, and nothing happens.
>
> Of course it doesn't work. It's impossible
> to set the pickfirst selection set from a
> VBA macro executed with VBARUN or (vl-vbarun).
> It doesn't matter how you do it (via LISP or
> via ARX), it still does not work. This is
> because the VBA code executes in a context
> where the pickfirst selection cannot be set.
>
> Of course, if your user doesn't mind stepping
> through the code in the VBA IDE.... then it
> does work.
>
> Haarrrrrrr!
>
>
>
>
0 Likes
Message 10 of 11

Anonymous
Not applicable
Hi Chuck, You are correct. This thread got me to thinking and I did a
little testing to determine why I couldn't set the pickfirst ss. I figured
that it was because an acad command was running and as we know the pfss
can't be set when a command is active, so I tested for it:

Public Sub setPickFirst()
Dim lispCode As VLAX
Dim oEnt As AcadEntity, dPnt() As Double

Set lispCode = New VLAX
With ThisDrawing
MsgBox .GetVariable("cmdactive") & vbCr & .GetVariable("cmdnames")
End With
ThisDrawing.Utility.GetEntity oEnt, dPnt, "Select object: "

lispCode.EvalLispExpression "(setq ss (ssadd))"
lispCode.EvalLispExpression "(ssadd " & _
"(handent " & Chr(34) & oEnt.Handle &
Chr(34) & ")" & _
"ss" & _
")"
lispCode.EvalLispExpression "(sssetfirst nil ss)"
lispCode.EvalLispExpression "(setq ss nil)"

Set lispCode = Nothing
End Sub

I found out, the hard way 😉 ,that (vl-vbarun) actually runs the VBARUN
command. Also, when running a VBA macro an undocumented 6th bit is set in
the CMDACTIVE sysvar. At least up to a2ki it's undocumented...All in all,
this has been an extremely informative thread for me. Thanks Chuck and
Tony.

;;;Test 1
(vl-vbarun "testModule.setPickFirst")
CMDACTIVE = 33
CMDNAMES = -VBARUN

;;;Test 2
(vla-runmacro (vlax-get-acad-object) "setpickfirst")
CMDACTIVE = 32
CMDNAMES = ""
--
Bobby C. Jones
http://www.acadx.com
0 Likes
Message 11 of 11

Anonymous
Not applicable
"Chuck Gabriel" wrote in message
news:81D0950E6343CA55AD0F9A72747FBAFB@in.WebX.maYIadrTaRb...
> I think you can overcome this limitation (not being able to use the
> pickfirst selection set) by using vla-runmacro to run your macro from
lisp.

Good point. I forgot about (vl-runmacro).

However, I've already have a much better way to do this
that works with any number of objects in the selection set,
without regards for whether it is the previous selection
set or not.
0 Likes