Jump to content

Recommended Posts

Posted

Just wondering if the .Angle property of a line returns the angle in

radians or degrees.

 

Any advice on a great reference guide for AutoCAD vbdotNET.

The AutoDesk vbdotnet developer's guide is good, but very limited.

 

Thanks,

 

Kevin

Posted
Just wondering if the .Angle property of a line returns the angle in

radians or degrees.

 

Any advice on a great reference guide for AutoCAD vbdotNET.

The AutoDesk vbdotnet developer's guide is good, but very limited.

 

Thanks,

 

Kevin

Take a look at this site

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer%27s%20Guide/index.html?url=WS73099cc142f48755-5c83e7b1120018de8c0-1fdb.htm,topicNumber=d0e42241

 

~'J'~

Posted

I have that link, and it is good, but as I said very limited.

And unfortunately does not have anything about the properties of a Line object.

Posted

Angles are always expressed as radians within the API. They would only be converted to Degrees (or Grads, Surveyor units) during user interface. See the useful AutoDesk.AutoCAD.Runtime.Converter class for that phase.

Posted
I have that link, and it is good, but as I said very limited.

And unfortunately does not have anything about the properties of a Line object.

 

Here is a quick code, see result in the command line

Public Shared Sub SelectLines()
Dim doc As Document = acadApp.DocumentManager.MdiActiveDocument
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim ed As Editor = doc.Editor
Dim tr As Transaction = db.TransactionManager.StartTransaction()
Try
 Using tr
  Dim tvs As TypedValue() = New TypedValue() {New TypedValue(DirectCast(DxfCode.Start, Integer), "LINE")}
  Dim sf As New SelectionFilter(tvs)
  Dim psr As PromptSelectionResult = ed.SelectAll(sf)
  Dim sset As SelectionSet = psr.Value

  If sset.Count = 0 Then
   Return
  End If
  For Each sobj As SelectedObject In sset
   Dim dbobj As DBObject = tr.GetObject(sobj.ObjectId, OpenMode.ForRead)
   Dim line_obj As Line = TryCast(dbobj, Line)
   If line_obj <> Nothing Then
    Dim ang As Double = line_obj.Angle ''<--always in radians
    ed.WriteMessage(vbLf & "Angle = {0} radians, {1} degrees", Math.Round(ang, 3), Autodesk.AutoCAD.Runtime.Converter.AngleToString(ang, AngularUnitFormat.Degrees, 3))
< process lines here >
   End If
  Next
  tr.Commit()
 End Using
Catch ex As System.Exception
 ed.WriteMessage(ex.Message + vbLf + ex.StackTrace)
End Try

End Sub

 

You can also use Intellsense to show

properties and methods in the editor

 

~'J'~

Posted

I will try this thank you. Do you know of a good resource for all the autodesk.autocad.stuff.morestuff etc.? I've learned a bit just by searching, the autodesk developers guide, and trial and error; but I'd like something more comprehensive.

 

Thanks for your help,

 

Kevin

Posted
I will try this thank you. Do you know of a good resource for all the autodesk.autocad.stuff.morestuff etc.? I've learned a bit just by searching, the autodesk developers guide, and trial and error; but I'd like something more comprehensive.

 

Thanks for your help,

 

Kevin

 

Unfortunately, no

Still going the same way

Happy coding :)

 

~'J'~

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...