社区
AutoCAD综合讨论区
欢迎访问欧特克AutoCAD论坛!分享知识,发帖提问,浏览AutoCAD热帖。
取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Effects of spatial scaling(空间缩放的影响)

7 条回复7
已解决
回复
1 条消息(共 8 条)
1294215115
1109 次查看, 7 条回复

Effects of spatial scaling(空间缩放的影响)

    I used it The select method wants to obtain objects in CAD drawings. It can meet the expected requirements under the appropriate size of the spatial view. However, when the view is zoomed (zoom - > A) to all, it obtains additional data. How can I solve this problem? thank you !

    我使用了 .select 方法, 想获取CAD图形中的对象, 在空间视图合适的尺寸下, 它能完成预期要求, 但是, 当视图被缩放(zoom -> a)至全部时, 它获取多余的其他数据。

 

   我该如何解决这个问题? 谢谢!

标记 (2)
标签 (2)
7 条回复7
2 条消息(共 8 条)

ZOOM ALL zooms to the extents of the entire drawing plus some. From help:

All

Zooms to display all visible objects and visual aids.

Adjusts the magnification of the drawing area to accommodate the extents of all visible objects in the drawing, or visual aids such as the grid limits (the LIMITS command), whichever is larger.

 

If you want to zoom to the area for which you have the exact coordinates, use the zoom window command and specify the coordinates of the window.

 

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

3 条消息(共 8 条)

Thank you for your reply!
The expected effect can be achieved by zooming the view
Another: I want to know how to get the zoom factor of the current view (for example, after zooming in the view with the mouse wheel)

 

感谢的你的回复!
通过缩放视图可以达到预计效果.
另: 我想知道如何获取当前视图的缩放因子(比如: 使用鼠标滚轮对视图进行放大操作后)

4 条消息(共 8 条)

Here's a function I wrote to get the vp scale.

Public Function GetVPScale()

    'returns the current viewport scale
    'error checking: i.e., is PViewport active?
    If ThisDrawing.ActiveSpace = acPaperSpace And ThisDrawing.MSpace = True Then
    'Two ways to find viewport scale:
    'First gets a ratio of the paperspace viewport's height
    'to the height of the modelspace view
'        Dim curPViewport As AcadPViewport
'        Dim h1 As Double, h2 As Double
'        Dim vpScale As Variant     'debugger
'        Set curPViewport = ThisDrawing.ActivePViewport
        'get height of viewport in ps units
'        h1 = curPViewport.Height
        'get height of viewport in ms units
'        h2 = ThisDrawing.GetVariable("viewsize")
        'MsgBox vpScale             'debugger
'        GetVPScale = h2 / h1
    'The second gets the z vector of the paperspace view. The Z coordinate is scaled
    'but never translated. Therefore, it can be used to find the scale factor between
    'the Paperspace Display Coordinate System (PSDS)and the DCS of the current viewport.
        Dim TransPoint As Variant, NewPoint As Variant
        Dim pt(0 To 2) As Double
        pt(0) = 0#
        pt(1) = 0#
        pt(2) = 1#
        TransPoint = pt
        NewPoint = ThisDrawing.Utility.TranslateCoordinates(TransPoint, acPaperSpaceDCS, acDisplayDCS, False)
        GetVPScale = NewPoint(2)    'return z value of array
    End If
    
End Function

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

5 条消息(共 8 条)

Thank you for your reply. I used the code example you provided, but it doesn't seem to work in model space
Another: I found that my purpose can be achieved in the Properties tab (which may need calculation). I can't get the parameters now. How can I get the parameters in the Properties tab?
Attached drawing < yellow box area >

 

谢谢你的回复。我使用了您提供的代码示例,但它似乎无法在模型空间中使用.
另一个:我发现我的目的可以在特性选项卡中实现(可能需要计算)。我现在无法获取其中的参数, 如何获取特性选项卡中的参数?
附图<黄框区域>

 

捕获.png

6 条消息(共 8 条)

The code I gave you gives you the scale of a paperspace viewport. The yellow box you show is the extents of the current view. You asked for the "zoom factor". Which do you want?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

7 条消息(共 8 条)

Maybe I didn't express clearly, sorry!
I mean, I used the code you provided, which can only be used in the layout space. If it is run in the model space, it will report an error message (runtime error: -2145320867).
The yellow area in my drawing refers to how to obtain it. Key information: Properties panel - > parameters therein.

可能是我没表达清晰,抱歉!
我的意思是, 我使用了你提供的代码, 它只能再布局空间中使用, 如果在模型空间中运行它会报错误信息(运行时错误: -2145320867)。

我的附图里黄色区域, 是指有什么方法可以获取它。 关键信息: 特性面板-> 其中的参数。
8 条消息(共 8 条)

You could use

ThisDrawing.GetVariable("viewctr")

ThisDrawing.GetVariable("viewsize")

 

But veiwsize only give the height. I can't find anything in vba that returns the current view width or coordinates. You can get the current view using the VIEW command. You could also save it as a named view. But the vba api doesn't have a CurrentView property.

 

In .NET, you can use the Editor.GetCurrentView Method.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

找不到想要的内容?向社区提问或分享您的知识。

到论坛发帖  

”