Author Topic: Code Issues  (Read 4258 times)

0 Members and 1 Guest are viewing this topic.

krampaul82

  • Guest
Code Issues
« on: August 22, 2013, 02:53:02 PM »
Hey guys,
 
i have this..
ThisDrawing.Application.ActiveDocument.Activate
    returnPnt = ThisDrawing.Utility.GetPoint(, "Select Insert Point: ")
    insertpoint(0) = returnPnt(0)
    insertpoint(1) = returnPnt(1)
    insertpoint(2) = returnPnt(2)
   
    ' Insert the block
   
    Dim blockRefObj As AcadBlockReference
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(returnPnt, "v:\Common_Assy\AHU\gtc_ahu_12-001.dwg", 1#, 1#, 1#, 0)
 This works fine but is the following possible?

     returnPnt = ThisDrawing.Utility.GetPoint(, "Select Insert Point: ")<---I would like to feed a value of 0,0,0 here for insertion without needing user input. 
 :|
    any help appreciated

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Code Issues
« Reply #1 on: August 22, 2013, 03:41:28 PM »
Try this instead....

Code - Visual Basic: [Select]
  1. Option Explicit
  2.  
  3. Public Sub InsertMyBlock()
  4.     MyInsertBlock ("e:\temp\revblk-1.dwg")
  5. End Sub
  6.  
  7. Sub MyInsertBlock(strBlockName As String)
  8.     Dim dblInsertPt(0 To 2) As Double
  9.     Dim dblScale As Double
  10.     Dim dblRotation As Double
  11.     Dim objAcadDoc As AcadDocument
  12.     Dim objBlockRef As AcadBlockReference
  13.    
  14.     dblInsertPt(0) = 0
  15.     dblInsertPt(1) = 0
  16.     dblInsertPt(2) = 0
  17.     dblScale = 1
  18.     dblRotation = 0
  19.    
  20.     Set objAcadDoc = ThisDrawing
  21.     Set objBlockRef = objAcadDoc.ModelSpace.InsertBlock(dblInsertPt, strBlockName, dblScale, dblScale, dblScale, dblRotation)
  22. End Sub
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

krampaul82

  • Guest
Re: Code Issues
« Reply #2 on: August 23, 2013, 01:42:36 PM »
Matt

as always,
Works wonderfully this solves a few other projects as well! Thank You for your prompt reply to my little quandry.

Mark

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Code Issues
« Reply #3 on: August 23, 2013, 01:49:28 PM »
 :kewl:
You're welcome!
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io