Author Topic: Copy Paste and chamfer  (Read 1785 times)

0 Members and 1 Guest are viewing this topic.

sigster

  • Newt
  • Posts: 31
Copy Paste and chamfer
« on: May 17, 2021, 07:11:48 AM »
I am wonder how can I make copy of the center line and chamfer each line to the side line

I can make copy but have no idea how I can do the rest

Regards
Sigster


Code: [Select]
  <CommandMethod("COPYPASTE")>
    Public Shared Sub CopyPaste()
        Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        Dim db As Database = doc.Database
        Dim ed As Editor = doc.Editor

        Dim peo As New PromptEntityOptions(vbLf & "Select object:")
        Dim per As PromptEntityResult = ed.GetEntity(peo)

        If per.Status <> PromptStatus.OK Then

            Return
        End If

        Dim optString As New PromptStringOptions("Select a number 1 to ?: ")
        optString.UseDefaultValue = True
        optString.AppendKeywordsToMessage = True
        optString.DefaultValue = "NUMBER"
        Dim resPrompt As PromptResult = ed.GetString(optString)
        If resPrompt.Status <> PromptStatus.OK Then
        End If

        Dim i As Integer = 0

        If per.Status = PromptStatus.Cancel Then Return
        Do Until i = Int(resPrompt.StringResult)
            Using tr As Transaction = db.TransactionManager.StartTransaction()
                Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord)
                Dim sourceId As ObjectId = per.ObjectId
                Dim EntitySource As Entity = CType(tr.GetObject(sourceId, OpenMode.ForRead), Entity)
                Dim ids As New ObjectIdCollection()
                ids.Add(sourceId)
                db.DeepCloneObjects(ids, db.CurrentSpaceId, New IdMapping, False)
                Dim EntityCopy As Entity = CType(tr.GetObject(ids(0), OpenMode.ForRead), Entity)
                EntityCopy.UpgradeOpen()
                EntityCopy.TransformBy(Matrix3d.Displacement(per.PickedPoint.GetVectorTo(per.PickedPoint)))
                'EntityCopy.ColorIndex = 2
                tr.Commit()

            End Using
            i += 1
        Loop

    End Sub


« Last Edit: May 24, 2021, 12:12:15 AM by sigster »

n.yuan

  • Bull Frog
  • Posts: 348
Re: Copy Paste and chamber
« Reply #1 on: May 20, 2021, 09:15:17 AM »
The reason that no one responds to your question could be:

1. What does it mean "chamber" in AutoCAD? Or maybe, it is a typo of "chamfer"?

2. If you do mean "chamfer", where is the corner you want to make a chamfer cut? Your picture does not show enough hints.

You might as well show pictures of "before" and "after" to better/clearly explain what you are to do.

sigster

  • Newt
  • Posts: 31
Re: Copy Paste and chamber
« Reply #2 on: May 21, 2021, 11:33:00 AM »
Yes chamfer sorry wrong letter (b/f)

before I have 1 Polyline from 0, I need to make 6 copies of the Polyline 0 and connect to polyline from each number

I can use the code = COPYPASTE and make 6 copies of Polyline = 0 and then just do chamfer later
but was thinking if I can do this in one command

after I have 6 Polyline from 0 to each number.

I upload new pictures and DWG file

Regards
Sigster