Hello, I have code to insert a block and explode it. But I'm now wondering how to set the thickness of the polyline afterwards. Here is what I have so far:
Private Sub InsertBlock(ByVal acadapp As Autodesk.AutoCAD.Interop.AcadApplication, _ ByVal acadDoc As Autodesk.AutoCAD.Interop.AcadDocument, _ ByVal InsertionPT As Object, _ ByVal BlockName As String) Dim DbxDoc As Object = acadapp.GetInterfaceObject "ObjectDBX.AxDbDocument.19") DbxDoc.Open(BlockDrawing) Dim Objects(0) As AcadBlock For Each entry As AcadBlock In CType(DbxDoc.Blocks, IEnumerable) If (Not entry.IsLayout) AndAlso (Not entry.Name.StartsWith("*")) Then Objects(0) = entry DbxDoc.CopyObjects(CObj(Objects), acadDoc.Blocks) End If Next entry Dim oBlkRef As AcadBlockReference oBlkRef = acadDoc.ModelSpace.InsertBlock(InsertionPT, BlockName, 1.0#, 1.0#, 1.0#, 0) oBlkRef.Explode() End Sub
The insert block code was supplied to me by Mikko and works great. Thanks again Mikko. But now I'm trying to relieve the user of another step by setting the thickness of the polyline inserted based upon the insertion point. Any help would be appreciated, Thank you.
Solved! Go to Solution.
Solved by _gile. Go to Solution.
But I am trying to set the thickness property, not the width of the polyline.
I try to look through the help docs, but it's hard to find anything on the out of process commands. With the time it is taking me to try and figure it out, I'm probably going to have to write some AutoLisp programs that I can start from my VB.Net program program using SendCommand. I appreciate the help though.
cncah a écrit :
I try to look through the help docs, but it's hard to find anything on the out of process commands. With the time it is taking me to try and figure it out, I'm probably going to have to write some AutoLisp programs that I can start from my VB.Net program program using SendCommand. I appreciate the help though.
If I do not misunderstand, for your "out of process" program, you're using the COM API (ActiveX Automation library) which is the same as the one used by VBA and Visual LISP. You'd find the docs for this API here:
%ProgramFiles%\Common Files\Autodesk Shared\acadauto.chm
Dim plineObj As AcadLWPolyline Dim thickness As Double ... plineObj.Thickness = thickness
Thanks for the tip. I got slammed at work and had to put the project on hold for a couple of days but I looked up the help doc that you suggested and thanks a ton for that! I was able to get the polyline into a selection set and set the thickness and change the layer name just fine. I have a question though, I'm using this to get my selection set:
Dim SelSet As Autodesk.AutoCAD.Interop.AcadSelectionSet SelSet = ACADapp.ActiveDocument.SelectionSets.Add("SelSet") SelSet.Select(AcSelect.acSelectionSetLast)
Would it be better to try and build the selection set by getting the polyline by layer name or is "AcSelect.acSelectionSetLast" good enough for what I am doing? Just trying to make the program bulletproof is all.