How to pass ObjectIdCollection into built-in Rotate command?

How to pass ObjectIdCollection into built-in Rotate command?

Anonymous
Not applicable
5,539 Views
23 Replies
Message 1 of 24

How to pass ObjectIdCollection into built-in Rotate command?

Anonymous
Not applicable

Hello,

 

First time user here. I am trying to rotate a bunch of entities like so:

 

rotate_Conveyro.png

 

This image represents a bunch of lines, blocks, circles etc being rotated using the built-in AutoCAD rotate command. 

 

Knowing that I can access all of those object IDs and store them into an ObjectIDCollection, how do I go about passing that collection into the rotate command? Is this possible? Or do I need to build a rotate command from scratch? Perhaps there's an easier way of doing all this ...?

0 Likes
Accepted solutions (1)
5,540 Views
23 Replies
Replies (23)
Message 21 of 24

Anonymous
Not applicable

Hi Gilles,

 

I have a question for the rotate class. How would you go about specifying to start the angle at an actual 0 instead of starting the angle from where the object actually is? I'm not sure if I'm being clear on this...

 

I took a screenshot to demonstrate:

rotation.png

 

Basically either I start the angle from the current angle of the entities OR I can start from zero. I'm trying to implement this in the RotateJig class but I can't really grasp where to modify the code so that it doesn't start from its current angle (if specified)... 

 

Thanks

Alex

0 Likes
Message 22 of 24

_gile
Consultant
Consultant

Hi,

 

I do not understand what you mean with: "the angle from where the object actually is".

AFAIK, only some entites as BlockReference, DBText, MText have a Rotation property which can be different from 0, and so, been used as reference angle.

For others entites as Line, Polyline,... , you cannot say if the have been rotated or not, so you cannot have another start angle than 0.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 23 of 24

samernajjar
Contributor
Contributor

Hi Gil,

I came across this as I have the same problem, except that I'm trying to pass the selection set to a lisp command through the SendStringToExecute() method.

It is a CADMEP Fabrication lisp function which functionality is not exposed by the .net fabrication API.

Is there a way around this? Either by passing the selection set as string or by using something other than SendStringToExecute()?

 

Thanks,

Sam

0 Likes
Message 24 of 24

ActivistInvestor
Mentor
Mentor

@Anonymous wrote:

Hi Gil,

I came across this as I have the same problem, except that I'm trying to pass the selection set to a lisp command through the SendStringToExecute() method.

It is a CADMEP Fabrication lisp function which functionality is not exposed by the .net fabrication API.

Is there a way around this? Either by passing the selection set as string or by using something other than SendStringToExecute()?

 

Thanks,

Sam


Select the objects in your .NET code, so they become the Previous selection set, then just pass "P" to the LISP code via SendStringToExecute() or SendCommand()

 

If the LISP code has a function that's not a command-function but a function that takes arguments, and it can be registered using (vl-acad-defun) then you can use the Application.Invoke() method to call the function from managed code.

0 Likes