Author Topic: Code Issues  (Read 3325 times)

0 Members and 1 Guest are viewing this topic.

krampaul82

  • Newt
  • Posts: 179
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
When i see someone fall, my first instinct is to laugh!
but then i think, wait a minute! they could of fallen on ME!
Mark

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

  • Newt
  • Posts: 179
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
When i see someone fall, my first instinct is to laugh!
but then i think, wait a minute! they could of fallen on ME!
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