Jump to content

Search the Community

Showing results for tags 'objectidcollection'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 2 results

  1. I have just started learning AutoLISP from different posts on the forums and through the reference material from Autodesk but, I am hitting an error in my lisp routine that I don't know how to fix. I am trying to right a while loop that will go through a nested list and use information in the selected list segment to find points in reference to a Polyline using the vlax-curve-* functions. Currently I am using the vlax-curve-getPointAtDist with a variable distance and using a user defined polyline from the document. My code runs up until the point I try to use the getPointAtDist line which will return the error of "unable to find ObjectID for . The way I get the polyline from the user is a (setq Var (ssget "_+.:s" '((0 . "*POLYLINE")))). I have earlier in the routine the vla-load-com to load in all of the functions of visual lisp. Can anyone help me out on what I need to do to be able to run the vlax-curve-* functions?
  2. Hello, Our users must be able to rotate a bunch of lines, circles, blocks etc (which result in looking like a conveyor). I am trying to pass a SelectionSet using the built-in rotate command of AutoCAD. I got a lot of help on the AutoDesk forums: http://forums.autodesk.com/t5/net/how-to-pass-objectidcollection-into-built-in-rotate-command/m-p/5429159#M42620 I seem to be in a stalemate right now. I don't have AutoCAD 2015 so I use a RunCommand wrapper to enable me to use the editor.Command(). Imports System.Collections.Generic Imports System.Linq Imports System.Text Imports System.Linq.Expressions Imports System.Reflection Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.EditorInput Module EditorInputExtensionMethods <System.Runtime.CompilerServices.Extension()> _ Public Function Command(editor As Editor, ParamArray args As Object()) As PromptStatus If editor Is Nothing Then Throw New ArgumentNullException("editor") End If Return runCommand(editor, args) End Function Dim runCommand As Func(Of Editor, Object(), PromptStatus) = GenerateRunCommand() Private Function GenerateRunCommand() As Func(Of Editor, Object(), PromptStatus) Dim method As MethodInfo = GetType(Editor).GetMethod("RunCommand", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.[Public]) Dim instance As ParameterExpression = Expression.Parameter(GetType(Editor), "editor") Dim args As ParameterExpression = Expression.Parameter(GetType(Object()), "args") Return Expression.Lambda(Of Func(Of Editor, Object(), PromptStatus))(Expression.Call(instance, method, args), instance, args).Compile() End Function End Module I then populate my SelectionSet using an object ID collection that was built. Here is my code that I use to try and use the already built-in rotate command that AutoCAD has to offer: <CommandMethod("My-Rotate")> _ Public Sub MyRotate() 'Get the current document and database Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim acCurDb As Database = acDoc.Database Dim acObj As Object Dim entRes As PromptEntityResult Dim entOpts As PromptEntityOptions Dim rb As ResultBuffer Dim FoundHunter As Boolean Dim acBlkTbl As BlockTable Dim acBlkTblRec As BlockTableRecord Dim pickedPolyline As Polyline = Nothing Dim SelSet As SelectionSet Dim Lst_ObjId As New List(Of ObjectId) 'Prompt user to select the conveyor he wants to rotate Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView() entOpts = New PromptEntityOptions(vbLf & "Choose the object you wish to rotate") entRes = acDoc.Editor.GetEntity(entOpts) If (entRes.Status = PromptStatus.OK) Then 'Start a transaction Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() acObj = entRes.ObjectId.GetObject(OpenMode.ForRead) 'Make sure the selected object was a polyline If Not TypeOf acObj Is Polyline Then MsgBox("You must choose a line or polyline") : Exit Sub rb = New ResultBuffer rb = entRes.ObjectId.GetObject(OpenMode.ForRead).XData() 'Sets the correct Project Conveyor ProjectConveyor.SetByDataTable(GetPKFromResultBuffer(rb), Project.PK_Project) 'Open the Block table for read acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) 'Open the Block table record Model space for write acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite) 'Go through the Block Table Record and build the collection ID For Each acObjId As ObjectId In acBlkTblRec rb = New ResultBuffer rb = acObjId.GetObject(OpenMode.ForRead).XData() FoundHunter = False If Not rb Is Nothing Then For Each tv As TypedValue In rb If tv.TypeCode = DxfCode.ExtendedDataRegAppName Then If tv.Value = "MY_PROGRAM_NAME" Then FoundHunter = True End If If FoundHunter And tv.TypeCode = DxfCode.ExtendedDataInteger32 Then If tv.Value = ProjectConveyor.PK_ProjectConveyor Then Lst_ObjId.Add(acObjId) 'Sets up all object IDs correctly here Exit For End If End If Next rb.Dispose() End If Next 'Create a selection set from object IDs SelSet = SelectionSet.FromObjectIds(Lst_ObjId.ToArray) 'Use AUTOCAD's Rotate function knowing we have all selections in selection set acDoc.Editor.Command("_.rotate", SelSet, "") 'Save the new objects to the database ProjectConveyor.Update() acTrans.Commit() End Using End If End Sub My issue is, whenever I get to the acDoc.Editor.Command() portion, it does not prompt the user to rotate anything. It returns Error(-5001) ... Any ideas?
×
×
  • Create New...