yuangw1234 发表于 2006-5-18 22:47:00

提取blockreference中一个圆的方法

<P>假如一个块中有一个圆及两条直线,我现在想得到块中圆的大小,请问用什么方法较好</P>
<P>望大师指点,谢谢</P>
<P>以下是acad帮助,为什么没有item这个属性</P>
<P>
<TABLE cellSpacing=1 cellPadding=4 border=0>
<TBODY>
<TR vAlign=top>
<TD>
<P class=Heading-2>Methods <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_arraypolar.htm" target="_blank" >
<P class=body>ArrayPolar</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_arrayrectangular.htm" target="_blank" >
<P class=body>ArrayRectangular</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_copy.htm" target="_blank" >
<P class=body>Copy</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_delete.htm" target="_blank" >
<P class=body>Delete</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_explode.htm" target="_blank" >
<P class=body>Explode</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_getattributes.htm" target="_blank" >
<P class=body>GetAttributes</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_getboundingbox.htm" target="_blank" >
<P class=body>GetBoundingBox</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_getconstantattributes.htm" target="_blank" >
<P class=body>GetConstantAttributes</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_getextensiondictionary.htm" target="_blank" >
<P class=body>GetExtensionDictionary</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_getxdata.htm" target="_blank" >
<P class=body>GetXData</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_highlight.htm" target="_blank" >
<P class=body>Highlight</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_intersectwith.htm" target="_blank" >
<P class=body>IntersectWith</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_mirror.htm" target="_blank" >
<P class=body>Mirror</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_mirror3d.htm" target="_blank" >
<P class=body>Mirror3D</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_move.htm" target="_blank" >
<P class=body>Move</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_rotate.htm" target="_blank" >
<P class=body>Rotate</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_rotate3d.htm" target="_blank" >
<P class=body>Rotate3D</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_scaleentity.htm" target="_blank" >
<P class=body>ScaleEntity</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_setxdata.htm" target="_blank" >
<P class=body>SetXData</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_transformby.htm" target="_blank" >
<P class=body>TransformBy</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_update.htm" target="_blank" >
<P class=body>Update</A> &nbsp;</P></TD>
<TD>
<P class=Heading-2>Properties <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_application.htm" target="_blank" >
<P class=body>Application</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_document.htm" target="_blank" >
<P class=body>Document</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_hyperlinks.htm" target="_blank" >
<P class=body>Hyperlinks</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_handle.htm" target="_blank" >
<P class=body>Handle</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_hasattributes.htm" target="_blank" >
<P class=body>HasAttributes</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_hasextensiondictionary.htm" target="_blank" >
<P class=body>HasExtensionDictionary</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_insertionpoint.htm" target="_blank" >
<P class=body>InsertionPoint</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_layer.htm" target="_blank" >
<P class=body>Layer</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_linetype.htm" target="_blank" >
<P class=body>Linetype</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_linetypescale.htm" target="_blank" >
<P class=body>LinetypeScale</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_lineweight.htm" target="_blank" >
<P class=body>Lineweight</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_name.htm" target="_blank" >
<P class=body>Name</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_normal.htm" target="_blank" >
<P class=body>Normal</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_objectid.htm" target="_blank" >
<P class=body>ObjectID</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_objectname.htm" target="_blank" >
<P class=body>ObjectName</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_ownerid.htm" target="_blank" >
<P class=body>OwnerID</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_plotstylename.htm" target="_blank" >
<P class=body>PlotStyleName</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_rotation.htm" target="_blank" >
<P class=body>Rotation</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_TrueColor_property.htm" target="_blank" >
<P class=body>TrueColor</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_visible.htm" target="_blank" >
<P class=body>Visible</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_xscalefactor.htm" target="_blank" >
<P class=body>XScaleFactor</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_yscalefactor.htm" target="_blank" >
<P class=body>YScaleFactor</A> <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_zscalefactor.htm" target="_blank" >
<P class=body>ZScaleFactor</A> &nbsp;</P></TD>
<TD>
<P class=Heading-2>Events <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_modified.htm" target="_blank" >
<P class=body>Modified</A> &nbsp;</P></TD></TR></TBODY></TABLE></P>

xinghesnak 发表于 2006-5-19 08:46:00

<P>睽睽</P>

xinghesnak 发表于 2006-5-19 09:21:00

个人觉得从AcadBlockReference中提取圆的参数,困难!不过可以得到它的name,然后得到对应的AcadBlock,在它里面提取圆的参数就容易了,没办法,变通一下。。。。

hutao722 发表于 2006-5-21 15:00:00

我也面临类似的问题,看到帮助中说可以先把块参照给分解,然后再读取对象,可是分解后不知道怎么组合块参照了

xinghesnak 发表于 2006-5-22 09:51:00

<P>To 4 楼:</P>
<P>帮助里说的如果要在块参照中添加或删除对象,必须要先炸开。。。。你这么理解倒也无可厚非,在前面怎么组合块参照也提到了</P>
<P>
<TABLE cellSpacing=1 cellPadding=4 border=0>
<TBODY>
<TR vAlign=top>
<TH align=left>
<P class=Bullet2>VBA class name:</P></TH>
<TD>
<P class=Bullet2>AcadBlockReference&nbsp;</P></TD></TR>
<TR vAlign=top>
<TH align=left>
<P class=Bullet2>Create using:</P></TH>
<TD>
<P class=Bullet2>ModelSpace.InsertBlock<BR>PaperSpace.InsertBlock<BR>Block.InsertBlock&nbsp;</P></TD></TR>
<TR vAlign=top>
<TH align=left>
<P class=Bullet2-end>Access via:</P></TH>
<TD>
<P class=Bullet2-end>ModelSpace.Item<BR>PaperSpace.Item<BR>Block.Item<BR>SelectionSet.Item<BR>Group.Item&nbsp;</P></TD></TR></TBODY></TABLE></P>
<P class=body>To create a block reference, first you must create a block definition, or block, by using the <A href="mk:@MSITStore:C:\Program%20Files\MDT6\HELP\ACADAUTO.CHM::/idh_add.htm" target="_blank" >Add</A> method. Once created, you can insert an instance of this block into your drawing using the <A href="mk:@MSITStore:C:\Program%20Files\MDT6\HELP\ACADAUTO.CHM::/idh_insertblock.htm" target="_blank" >InsertBlock</A> method.</P>
<P class=body>意思就是说先在thisdrawing.application.activedocument.blocks中使用add增加一个块定义,然后用InsertBlock将分解后返回的对象添加到块定义中。。。。。</P>
<P class=body>不过这种方法不太好,每提一回属性就要把块参照炸碎一回,这个不符合VBA的编程要求。。。。。</P>

yuangw1234 发表于 2006-5-22 16:51:00

在此先谢3楼楼主

hutao722 发表于 2006-5-22 19:06:00

<P>也许先在块定义前,获取块内对象的句柄,这样就通过句柄查看可能好些</P>

霹雳啪啦啦 发表于 2006-5-23 16:29:00

<P>应该根据块参照的name属性,得到相应的块,然后取得块中圆的大小.得到块中圆的大小后,还需要检索块属性的scalefactor属性,可以知道块参照放大缩小的比例,然后就可以知道圆有多少大了.</P>

xinghesnak 发表于 2006-5-24 08:14:00

<P>楼上说的很对,还要检测scalfactor属性,顶顶!</P>

yuangw1234 发表于 2006-5-25 16:03:00

這麼多大師能幫忙,真的感謝
页: [1]
查看完整版本: 提取blockreference中一个圆的方法