Errors Using Curve function

Errors Using Curve function

Anonymous
Not applicable
690 Views
7 Replies
Message 1 of 8

Errors Using Curve function

Anonymous
Not applicable
I am using the VLAX/Curve functions to export the lengths of objects to a
database. I create a selectionset (filtered by line, polyline, circle, arc,
lwpolyline objects) and then FOR...EACH to get the length.

It works great on smaller drawings but on bigger drawings i get problems
like...
error; too few arguments OR
Automation error "The object invoked has dicsonnected from its clients"
Any ideas?
Thanks....Sean
0 Likes
691 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
The connection to the VisualLISP interface seems to suffer under
high-stress conditions. Have you tried trapping the error and creating
a new VLAX object in response?

--
"That's no ordinary rabbit."
http://www.acadx.com


"Sean" wrote in message
news:[email protected]...
> I am using the VLAX/Curve functions to export the lengths of objects
to a
> database. I create a selectionset (filtered by line, polyline,
circle, arc,
> lwpolyline objects) and then FOR...EACH to get the length.
>
> It works great on smaller drawings but on bigger drawings i get
problems
> like...
> error; too few arguments OR
> Automation error "The object invoked has dicsonnected from its
clients"
> Any ideas?
> Thanks....Sean
>
>
0 Likes
Message 3 of 8

Anonymous
Not applicable
I'm not quite sure what you mean. I tried including an On Error Resume Next
just before the c.length property.
It seems to help sometimes. What are you suggesting? What do you think these
errors mean?
-Sean

"Frank Oquendo" wrote in message
news:[email protected]...
> The connection to the VisualLISP interface seems to suffer under
> high-stress conditions. Have you tried trapping the error and creating
> a new VLAX object in response?
>
> --
> "That's no ordinary rabbit."
> http://www.acadx.com
>
>
> "Sean" wrote in message
> news:[email protected]...
> > I am using the VLAX/Curve functions to export the lengths of objects
> to a
> > database. I create a selectionset (filtered by line, polyline,
> circle, arc,
> > lwpolyline objects) and then FOR...EACH to get the length.
> >
> > It works great on smaller drawings but on bigger drawings i get
> problems
> > like...
> > error; too few arguments OR
> > Automation error "The object invoked has dicsonnected from its
> clients"
> > Any ideas?
> > Thanks....Sean
> >
> >
>
>
0 Likes
Message 4 of 8

Anonymous
Not applicable
I'm suggesting that when the error occurs, you release the existing
Curve object and create a new one.

--
"That's no ordinary rabbit."
http://www.acadx.com


"Sean" wrote in message
news:[email protected]...
> I'm not quite sure what you mean. I tried including an On Error
Resume Next
> just before the c.length property.
> It seems to help sometimes. What are you suggesting? What do you
think these
> errors mean?
> -Sean
0 Likes
Message 5 of 8

Anonymous
Not applicable
okay. i'll try that.

"Frank Oquendo" wrote in message
news:[email protected]...
> I'm suggesting that when the error occurs, you release the existing
> Curve object and create a new one.
>
> --
> "That's no ordinary rabbit."
> http://www.acadx.com
>
>
> "Sean" wrote in message
> news:[email protected]...
> > I'm not quite sure what you mean. I tried including an On Error
> Resume Next
> > just before the c.length property.
> > It seems to help sometimes. What are you suggesting? What do you
> think these
> > errors mean?
> > -Sean
>
>
0 Likes
Message 6 of 8

Anonymous
Not applicable
"Sean" wrote

> I'm not quite sure what you mean. I tried including an On Error Resume
Next
> just before the c.length property.

FWIW, I've used the Curve class from AcadX.arx (www.caddzone.com), with
great success and haven't experienced any such problems with large (3-4 MB)
files. Anyways, if getting the length of all objects in a selection set is
all you need to do you don't even need third-party tools.

Just dimension your foreach variable as AcadEntity which lets you reference
the length property via late binding. If there are objects in the selection
set that have no length property an error occurs and you use On Error Resume
Next to go on to the next one:

Dim Ent As AcadEntity
...
On Error Resume Next
For each oEntity in YourSelectionSet
Length = Length + oEntity.Length
Next oEntity
On Error Goto 0
...

This should work regardless of what's in the selection set.

Regards,
Bill
0 Likes
Message 7 of 8

Anonymous
Not applicable
This is really bumming me out. I keep getting errors on bigger drawings.
(memory errors, or too few arguments errors). Here is the code I am using.
Any advice would be appreciated. All the objects in the links collection are
lines or polylines. But i STILL get errors. Its driving me nuts.

If objLinks.Count > 0 Then
For Each objLink In objLinks
Set acadEntity = ThisDrawing.ObjectIdToObject(objLink.objectId)
On Error Resume Next
Set c.Entity = acadEntity
If TypeOf acadEntity Is AcadLWPolyline Then
'If TypeOf acadEntity Is AcadLine Or AcadPolyline Or
AcadLWPolyline Or AcadArc Or AcadCircle Then
On Error Resume Next
rstQty.AddNew
On Error Resume Next
rstQty!Handle = acadEntity.Handle
On Error Resume Next
rstQty!Layername = acadEntity.Layer
On Error Resume Next
rstQty!Quantity = c.Length
If Err <> 0 Then
Set c = New Curve
End If
rstQty.Update
End If
If TypeOf acadEntity Is AcadLine Then
On Error Resume Next
rstQty.AddNew
On Error Resume Next
rstQty!Handle = acadEntity.Handle
On Error Resume Next
rstQty!Layername = acadEntity.Layer
On Error Resume Next
rstQty!Quantity = c.Length
If Err <> 0 Then
Set c = New Curve
End If
rstQty.Update
End If
Next
End If
rstQty.Close
cnn.Close


"Bill Wilkerson" wrote in message
news:[email protected]...
> "Sean" wrote
>
> > I'm not quite sure what you mean. I tried including an On Error Resume
> Next
> > just before the c.length property.
>
> FWIW, I've used the Curve class from AcadX.arx (www.caddzone.com), with
> great success and haven't experienced any such problems with large (3-4
MB)
> files. Anyways, if getting the length of all objects in a selection set is
> all you need to do you don't even need third-party tools.
>
> Just dimension your foreach variable as AcadEntity which lets you
reference
> the length property via late binding. If there are objects in the
selection
> set that have no length property an error occurs and you use On Error
Resume
> Next to go on to the next one:
>
> Dim Ent As AcadEntity
> ...
> On Error Resume Next
> For each oEntity in YourSelectionSet
> Length = Length + oEntity.Length
> Next oEntity
> On Error Goto 0
> ...
>
> This should work regardless of what's in the selection set.
>
> Regards,
> Bill
>
>
0 Likes
Message 8 of 8

Anonymous
Not applicable
i have cleaned up that code a little. It might be helping. I was using Curve
to get lengths of AcadLines (silly). I realize this isnt necessary, so i am
using the length property for lines and then Curve for polylines. Seems to
help.


"Sean" wrote in message
news:[email protected]...
> This is really bumming me out. I keep getting errors on bigger drawings.
> (memory errors, or too few arguments errors). Here is the code I am using.
> Any advice would be appreciated. All the objects in the links collection
are
> lines or polylines. But i STILL get errors. Its driving me nuts.
>
> If objLinks.Count > 0 Then
> For Each objLink In objLinks
> Set acadEntity =
ThisDrawing.ObjectIdToObject(objLink.objectId)
> On Error Resume Next
> Set c.Entity = acadEntity
> If TypeOf acadEntity Is AcadLWPolyline Then
> 'If TypeOf acadEntity Is AcadLine Or AcadPolyline Or
> AcadLWPolyline Or AcadArc Or AcadCircle Then
> On Error Resume Next
> rstQty.AddNew
> On Error Resume Next
> rstQty!Handle = acadEntity.Handle
> On Error Resume Next
> rstQty!Layername = acadEntity.Layer
> On Error Resume Next
> rstQty!Quantity = c.Length
> If Err <> 0 Then
> Set c = New Curve
> End If
> rstQty.Update
> End If
> If TypeOf acadEntity Is AcadLine Then
> On Error Resume Next
> rstQty.AddNew
> On Error Resume Next
> rstQty!Handle = acadEntity.Handle
> On Error Resume Next
> rstQty!Layername = acadEntity.Layer
> On Error Resume Next
> rstQty!Quantity = c.Length
> If Err <> 0 Then
> Set c = New Curve
> End If
> rstQty.Update
> End If
> Next
> End If
> rstQty.Close
> cnn.Close
>
>
> "Bill Wilkerson" wrote in message
> news:[email protected]...
> > "Sean" wrote
> >
> > > I'm not quite sure what you mean. I tried including an On Error Resume
> > Next
> > > just before the c.length property.
> >
> > FWIW, I've used the Curve class from AcadX.arx (www.caddzone.com), with
> > great success and haven't experienced any such problems with large (3-4
> MB)
> > files. Anyways, if getting the length of all objects in a selection set
is
> > all you need to do you don't even need third-party tools.
> >
> > Just dimension your foreach variable as AcadEntity which lets you
> reference
> > the length property via late binding. If there are objects in the
> selection
> > set that have no length property an error occurs and you use On Error
> Resume
> > Next to go on to the next one:
> >
> > Dim Ent As AcadEntity
> > ...
> > On Error Resume Next
> > For each oEntity in YourSelectionSet
> > Length = Length + oEntity.Length
> > Next oEntity
> > On Error Goto 0
> > ...
> >
> > This should work regardless of what's in the selection set.
> >
> > Regards,
> > Bill
> >
> >
>
>
0 Likes