Jump to content

Copy with base point using VBA


ab00

Recommended Posts

Hi,

 

I have some code where I want to copy an item to clipboard with base point, and paste into another drawing with insertion point. I have all my code working except the copy with base point section. 

 

  • The below code allows me to initialise the COPYBASE command but requires user input for the base point position:
sourceDoc.SendCommand "_SELECT All" & vbCr & vbCr

 sourceDoc.SendCommand "_copybase" & vbCr

 

  • I can't seem to find a way to code the base point into the command. I have tried the below code: 
sourceDoc.SendCommand "_copybase"  & " , " & basePoint(0)  &  " , "  &  basePoint(1)  &  " , "  &  basePoint(2)  &  vbCr

 

  • I have the paste command working with an insertion point but the COPYBASE command must work a different way.
destinationDoc.SendCommand "_pasteclip "  &  insertionPoint(0)  &  " , "  &  insertionPoint(1)  &  " , "  &  insertionPoint(2)  &  vbCr

 

If anyone could help this would be greatly appreciated. 

Edited by SLW210
Added Code Tags!
Link to comment
Share on other sites

In the future please use Code Tags for your code. (<> in the editor toolbar)

Link to comment
Share on other sites

If you look at using LISP rather than VBA there are lots of examples about using OBDX to do this task. This question was asked within a week either here or at Autodesk/forum.

Link to comment
Share on other sites

Can it be done in VBA though? If not then I'll look into LISP but I have a large code in VBA and this is the only part I cannot get working. 

 

Instead of having the user select the basepoint on screen after the COPYBASE command is initialised, I want a basepoint in my VBA code to be used the same way 'PASTECLIP' accepts the insertion point I have entered.  

Link to comment
Share on other sites

UPDATE

 

I found the solution...

 

sourceDoc.SendCommand "_copybase" & vbCr & basePoint(0) & "," & basePoint(1) & "," & basePoint(2) & vbCr

 

Instead of...

 

sourceDoc.SendCommand "_copybase" & basePoint(0) & "," & basePoint(1) & "," & basePoint(2) & vbCr

 

'vbCr' was required after initialising the command and before the base point coordinates are entered. 

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...