how to set normal of a region

how to set normal of a region

Anonymous
Not applicable
1,393 Views
10 Replies
Message 1 of 11

how to set normal of a region

Anonymous
Not applicable
Hi all,

how can i set the normal of a region object?? i have this:

dim AcRegion as AcadRegion
dim N as variant

N = AcRegion.Normal
N(0) = 0: N(1) = 0: N(2) = -1
AcRegion.Normal = N
'this gives the error message: runtime error 424, object required

so i can read the normal, but not set it. but it says in the help the
property is read/write
thanks
0 Likes
1,394 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable
If this is all your code then you are not reading it.

From the error message you need an object [AcadRegion].

Something like this:

Dim AcRegion As AcadRegion
Dim N(2) As Double

Set AcRegion =

N(0) = 0: N(1) = 0: N(2) = -1

AcRegion.Normal = N

AcRegion.Update


wrote in message news:5203902@discussion.autodesk.com...
Hi all,

how can i set the normal of a region object?? i have this:

dim AcRegion as AcadRegion
dim N as variant

N = AcRegion.Normal
N(0) = 0: N(1) = 0: N(2) = -1
AcRegion.Normal = N
'this gives the error message: runtime error 424, object required

so i can read the normal, but not set it. but it says in the help the
property is read/write
thanks
0 Likes
Message 3 of 11

Anonymous
Not applicable
Hi Joe,

As this query whetted my curiosity I copied the Example Sub for the Normal
command which uses a circle and it ran nicely.

I then modified it in general terms to work with a predrawn region which I
selected and found that for the Region I was getting an error message on the
line below to the effect that an object was needed.

AcRegion.Normal = N

I also tried

AcRegion.Normal(0) = 0

AcRegion.Normal(1) = 1

AcRegion.Normal(2) = -1
AcRegion.Update

and this code ran, but did not change the Normal of the region.

Hence, pending further information, I support the original post as it
applies to Regions.

--

Laurie Comerford
CADApps
www.cadapps.com.au

"Joe Sutphin" wrote in message
news:5203989@discussion.autodesk.com...
If this is all your code then you are not reading it.

From the error message you need an object [AcadRegion].

Something like this:

Dim AcRegion As AcadRegion
Dim N(2) As Double

Set AcRegion =

N(0) = 0: N(1) = 0: N(2) = -1

AcRegion.Normal = N

AcRegion.Update


wrote in message news:5203902@discussion.autodesk.com...
Hi all,

how can i set the normal of a region object?? i have this:

dim AcRegion as AcadRegion
dim N as variant

N = AcRegion.Normal
N(0) = 0: N(1) = 0: N(2) = -1
AcRegion.Normal = N
'this gives the error message: runtime error 424, object required

so i can read the normal, but not set it. but it says in the help the
property is read/write
thanks
0 Likes
Message 4 of 11

Anonymous
Not applicable
Sorry if I was writing and posting too quickly:

of course I have a valid region, it was created by using the .SectionSolid
method of a solid.
so now I have a region object, I can read the .Normal property, but I cannot
set it.
Setting that value works without any problem on circles or other objects
that have the .Normal method.
Now question is: How to set and change the .Normal property of a region?
hope I made the problem clear
thanks for any advice,
Rainer

"Joe Sutphin" schrieb im Newsbeitrag
news:5203989@discussion.autodesk.com...
If this is all your code then you are not reading it.

From the error message you need an object [AcadRegion].

Something like this:

Dim AcRegion As AcadRegion
Dim N(2) As Double

Set AcRegion =

N(0) = 0: N(1) = 0: N(2) = -1

AcRegion.Normal = N

AcRegion.Update


wrote in message news:5203902@discussion.autodesk.com...
Hi all,

how can i set the normal of a region object?? i have this:

dim AcRegion as AcadRegion
dim N as variant

N = AcRegion.Normal
N(0) = 0: N(1) = 0: N(2) = -1
AcRegion.Normal = N
'this gives the error message: runtime error 424, object required

so i can read the normal, but not set it. but it says in the help the
property is read/write
thanks
0 Likes
Message 5 of 11

Anonymous
Not applicable
I ran it too and I agree with your finding. It would appear, at least on the
surface, that you cannot change the Normal property of a Region object.

"Laurie Comerford" wrote in message
news:5204034@discussion.autodesk.com...
Hi Joe,

As this query whetted my curiosity I copied the Example Sub for the Normal
command which uses a circle and it ran nicely.

I then modified it in general terms to work with a predrawn region which I
selected and found that for the Region I was getting an error message on the
line below to the effect that an object was needed.

AcRegion.Normal = N

I also tried

AcRegion.Normal(0) = 0

AcRegion.Normal(1) = 1

AcRegion.Normal(2) = -1
AcRegion.Update

and this code ran, but did not change the Normal of the region.

Hence, pending further information, I support the original post as it
applies to Regions.

--

Laurie Comerford
CADApps
www.cadapps.com.au

"Joe Sutphin" wrote in message
news:5203989@discussion.autodesk.com...
If this is all your code then you are not reading it.

From the error message you need an object [AcadRegion].

Something like this:

Dim AcRegion As AcadRegion
Dim N(2) As Double

Set AcRegion =

N(0) = 0: N(1) = 0: N(2) = -1

AcRegion.Normal = N

AcRegion.Update


wrote in message news:5203902@discussion.autodesk.com...
Hi all,

how can i set the normal of a region object?? i have this:

dim AcRegion as AcadRegion
dim N as variant

N = AcRegion.Normal
N(0) = 0: N(1) = 0: N(2) = -1
AcRegion.Normal = N
'this gives the error message: runtime error 424, object required

so i can read the normal, but not set it. but it says in the help the
property is read/write
thanks
0 Likes
Message 6 of 11

Anonymous
Not applicable
Open the Object Browser in the VBA Editor. Select AcadRegion. Select the Normal property. Note the Description says read-only.

Regards - Nathan
0 Likes
Message 7 of 11

Anonymous
Not applicable
Just another one of those things that gets overlooked.
Thanks Nathan.

Joe
--

wrote in message news:5205182@discussion.autodesk.com...
Open the Object Browser in the VBA Editor. Select AcadRegion. Select the
Normal property. Note the Description says read-only.

Regards - Nathan
0 Likes
Message 8 of 11

Anonymous
Not applicable
Simplistically, a region is a coplanar collection of points, so there is only one normal vector.
A circle is defined as a center point and a radius and can be rotated about any axis, giving it any possible normal vector.

If you try to create a region out of non-coplanar points, you get an error message:

Command: region
Select objects: Specify opposite corner: 6 found
Select objects: Specify opposite corner: 5 found (2 duplicate), 9 total
Select objects:
Open objects must be coplanar.
0 Regions created.
0 Likes
Message 9 of 11

Anonymous
Not applicable
Hi Allen,

The existence of a "normal" vector to an area only makes logical sense if
the area is planar - as in a circle - or region etc. If the area object is
not planar, then the "normal" has to be defined to apply at a point on the
surface and will vary around the surface.

A region (which, as you say, must be planar) can have any orientation and
its "normal" will reflect that.

All we have discovered here is that the Autodesk help files are wrong in one
place and correct in another.

A corollary is that Autodesk should fix the API so that the normal for a
region can be changed consistently with other objects with a "normal"

--

Regards,


Laurie Comerford
www.cadapps.com.au

"Allen Johnson" wrote in message
news:5206001@discussion.autodesk.com...
Simplistically, a region is a coplanar collection of points, so there is
only one normal vector.
A circle is defined as a center point and a radius and can be rotated about
any axis, giving it any possible normal vector.

If you try to create a region out of non-coplanar points, you get an error
message:

Command: region
Select objects: Specify opposite corner: 6 found
Select objects: Specify opposite corner: 5 found (2 duplicate), 9 total
Select objects:
Open objects must be coplanar.
0 Regions created.
0 Likes
Message 10 of 11

Anonymous
Not applicable
No worries. As Laurie eluded to the Help file should remark that the property is read-only for Leaders, Regions and Sections.

Regards - Nathan
0 Likes
Message 11 of 11

Anonymous
Not applicable
>A region (which, as you say, must be planar) can have any orientation and its "normal" will reflect that.

If a region is coplanar, and by definition (of a normal vector) it can only have one direction for its normal vector (perpendicular
to the plane). If you want to change its "normal" vector you have to (3d) rotate the region (in space). That's why the normal
property for a region is read-only.
0 Likes