Is it possible to push data into clipboard and paste things into AutoCAD?

Haider_of_Sweden
Collaborator Collaborator
622 Views
8 Replies
Message 1 of 9

Is it possible to push data into clipboard and paste things into AutoCAD?

Haider_of_Sweden
Collaborator
Collaborator

If you're in AutoCAD, you can copy a line for example, with CTRL C, and then paste it back into AutoCAD with CTRL V.

 

I am wondering if the clipboard data, for example CTRL C of a line, can be "decoded" into ASCII.

The idea is, whether you could do it the other way around, to push data into the clipboard (ie from outside AutoCAD) so that once in AutoCAD and you press CTRL V, you will be pasting a line.

 

Is this doable?

 

0 Likes
623 Views
8 Replies
Replies (8)
Message 2 of 9

pendean
Community Legend
Community Legend
May I ask why, or what the goal/result is that you are seeking? Very intriguing 😉
0 Likes
Message 3 of 9

Sea-Haven
Mentor
Mentor

Line x,y x,y 

Note has a space on end to signify stop line,

Line x,y x,y x,y x,y

or

Line

x,y

x,y

               blank line as exit

 

In say excel can make a column of this type, for line just copy the column to command line and lines will be made. So many variations come to mind, Insert block with attributes, add points.

 

So if you can somehow make what you want then ctrl+c then ctrl+v to command line, been doooing it for years.

 

try this

POINT 1,10 pdmode 34

0 Likes
Message 4 of 9

Haider_of_Sweden
Collaborator
Collaborator
May I ask why, or what the goal/result is that you are seeking? Very intriguing 😉

Hi @pendean 

Originally, it started when the talented @leeminardi provided a great 3dsMax script here , solving an annoying problem; to properly export lines from 3dsMax to AutoCAD. The 3dsMax DWG-exporter is simply bad, subdividing the splines into ultra-heavy polylines.

 

In my script collection, I had these two scripts, inspiring me to check if Lee's script could be developed further:

  1. https://github.com/deshudiosh/PG.Ms/blob/master/_trunk/CurvesGetFromRhinoToMax.rvb - this is a Rhino script pushing curves into the clipboard.
  2. https://github.com/deshudiosh/PG.Ms/blob/master/_trunk/CurvesDrawFromRhinoToMax.ms - this is the max-script reading from the clipboard and turning things into Max-splines

 

This made me wonder if there could be a way to copy paste between 3dsMax and AutoCAD (and why not the other way around too) to skip the file-saving part.

For that, I needed to ask around how AutoCAD and the clipboard works. I searched google for some clipboard-inspecting tools, to see if they revealed anything.

 

I believe that if this has to work, the clipboard needs to be in ASCII. It can't hold software-specific stuff, right?

 

Now that I said the last sentence, I realize, could it be as simple as pushing the line segment coordinates to the clipboard from one end, and then reading it from the other end? I have seen examples of reading things from the clipboard in Lisp.

0 Likes
Message 5 of 9

Haider_of_Sweden
Collaborator
Collaborator

Line x,y x,y 

Note has a space on end to signify stop line,

Line x,y x,y x,y x,y

or

Line

x,y

x,y

               blank line as exit

 

In say excel can make a column of this type, for line just copy the column to command line and lines will be made. So many variations come to mind, Insert block with attributes, add points.

 

So if you can somehow make what you want then ctrl+c then ctrl+v to command line, been doooing it for


Hey @Sea-Haven 

 

If you read my previous post, explaining the background story, then your explanation might be the way to go; from e.g 3dsMax side, reading the line segments coordinates and converting them to AutoCAD commands. Then pushing those commands (wrapped as LISP) to the clipboard. In AutoCAD, could it work to press CTRL V to run the lisp?  This would be more intuitive (and maybe faster?) than pasting into command line.

0 Likes
Message 6 of 9

Sea-Haven
Mentor
Mentor

No reason why this

Line x1,y1 x2,y2 

can not be 

(command "line" x1,y1 x2,y2 "")

0 Likes
Message 7 of 9

Haider_of_Sweden
Collaborator
Collaborator
true. But I'll wait and see if there is anything that can be integrated with the clipboard. It would be way faster, I think, to paste stuff directly into the viewport.

If it is equal in speed, then probably the script I referred to previously (https://forums.autodesk.com/t5/3ds-max-forum/export-lines-nurbs-curves-to-dwg/m-p/10617462#M197747) could be done to write the stuff to the clipboard instead of an .SCR file. Then, you just go and press CTRL V into the command line.

Let's see what other answers the community has 🙂
0 Likes
Message 8 of 9

Sea-Haven
Mentor
Mentor

You should have kept going in other post, rather than start a new one as the match to 3DS max is very relevant. Does it take a long time now ? You could hard path the scr file location and have a defun that just runs that script a few micro seconds saved.

0 Likes
Message 9 of 9

Haider_of_Sweden
Collaborator
Collaborator

@Sea-Haven wrote:

You should have kept going in other post, rather than start a new one as the match to 3DS max is very relevant. Does it take a long time now ? You could hard path the scr file location and have a defun that just runs that script a few micro seconds saved.


I could, but I did not want to put too much pressure on Lee who helped me on that other post.

 

And yes, I could hard code the path. But this time, I am curious about the clipboard. I enjoy learning and discovering new things 🙂

0 Likes