Results 1 to 6 of 6

Thread: Offset curve exception

  1. #1
    Member
    Join Date
    2016-01
    Posts
    33
    Login to Give a bone
    0

    Default Offset curve exception

    Hello,

    According to AutoCAD.NET guide, Curve.GetOffsetCurves will offset inside in case of negative values. Now I did the following test:

    Draw circle with radius = 2 units, and 2x2 square
    Try to offset inside with distance = 2.5 as follows: var offsetObj = Curve.GetOffsetCurves(-2.5)
    This line has been silently skipped in case of the square (polyine) but raised an exception for the circle!!

    Is this a bug in AutoCAD.NET or am I missing something here?

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Offset curve exception

    What does the Exception.Message in your Try Catch block say?
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    Member
    Join Date
    2016-01
    Posts
    33
    Login to Give a bone
    0

    Default Re: Offset curve exception

    It only says "einvalidinput"

    Autodesk does not provide descriptive messages in most of the exceptions

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Offset curve exception

    Looking a bit more closely now....

    Quote Originally Posted by thesniper2003eng View Post
    According to AutoCAD.NET guide, Curve.GetOffsetCurves will offset inside in case of negative values. Now I did the following test:

    Draw circle with radius = 2 units, and 2x2 square
    Try to offset inside with distance = 2.5 as follows: var offsetObj = Curve.GetOffsetCurves(-2.5)
    This line has been silently skipped in case of the square (polyine) but raised an exception for the circle!!

    Is this a bug in AutoCAD.NET or am I missing something here?
    The Exception appears to be raised, as you've supplied an offset distance (double) greater than the source Curves will allow (hence, invalid input) - try supplying a value less than the radius, etc.

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    Member
    Join Date
    2016-01
    Posts
    33
    Login to Give a bone
    0

    Default Re: Offset curve exception

    I talking about inconsistency here, for circles raise an exception while fail silently in case of closed polylines. Should they behave similarly?

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Offset curve exception

    Quote Originally Posted by thesniper2003eng View Post
    I talking about inconsistency here, for circles raise an exception while fail silently in case of closed polylines. Should they behave similarly?
    Should an exception be raised when the GetOffsetCurves() Method is supplied an invalid offsetDist parameter (as double)?

    Yes, I believe it should, regardless of the Typed-Object (Class) the Method is being called on... In your example, a Circle, and Polyline, both of which derive from Curve.



    Is it an issue that it doesn't raise the exception for Polylines?

    No, as now knowing that it doesn't for this, if not other Types, you should test the GetOffsetCurves() Method's result, to validate, or throw an exception as needed - THAT only if you insist on allowing invalid input in your code logic in the first place.

    All of this goes away - all of it - if you'd simply test the offsetDist parameter's value (as double) against that Object which you're about to evaluate it against, thereby avoiding the issue entirely. Lemon squeezy.

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. 2011: label points at an offset from alignment showing stat, offset, and description
    By mw156 in forum AutoCAD Civil 3D - Survey
    Replies: 6
    Last Post: 2016-09-29, 06:10 PM
  2. 2015: Unable to offset a spline the has already been offset.
    By crullier in forum Inventor - General
    Replies: 1
    Last Post: 2014-12-19, 07:39 AM
  3. Replies: 0
    Last Post: 2011-10-11, 08:38 AM
  4. Offset a curve?
    By sfaust in forum Revit - API
    Replies: 5
    Last Post: 2009-06-16, 12:20 AM
  5. Label Curve Style: Clear Distance Offset
    By buzz in forum AMEP General
    Replies: 2
    Last Post: 2008-07-15, 04:36 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •