×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

lower left origin

lower left origin

lower left origin

(OP)
I'm looking for a simple code that will locate the origin of a window selected object at the lower left so that I can quickly diminsion that selection using the qdim ordinate method. I am wasting too much time creating this origin manually and would prefer to include it in the code for the button I've created for qdim (ordinate). Any suggestions?

RE: lower left origin

I am not quite sure what you mean. Are you picking a bunch of stuff in a window, and you only want the lower left corner of some entity in the selection? I hope I am clear on this.

BU

RE: lower left origin

(OP)
What I'm trying to do is dimension parts using the ordinate method. In order to do that, I need to establish o,o in the lower left corner of the part so that my ordinate dims start from that corner. But sometime there isn't a convenient corner in the lower left (ie. a filleted corner) and I have to project the theoretical corner in order to establish 0,0. What I'm looking for is a routine that will find the origin of a selection set based on it's geometry and reset the origin to that point automatically.

RE: lower left origin

Define your first point using .x and .y (and .z) point filters based on parts of your object with the correct x and y coordinates.

RE: lower left origin

(OP)
What I'm looking for is code that will allow me to select the object to be dimensioned with a pick box and it will find the lower left x,y,z coordinate by tracking the extreme edges to a theoretical intersection, set the origin to 0,0,0 at that point, and then dimension the part using the qdim ordinate method.

My objective is to minimize the steps of dimensioning by assigning this code to a button and then just window select each solviewed part on a drawing and thereby increasing the speed of our draftsmen.

I have already assigned code to accomplish everything except finding the lower left origin automatically. and it's this step I wish to make transparent as well.

RE: lower left origin

Hello,

I think you will find this site useful, specifically corner.zip!
http://www.cadresource.com/library/lispbc.html
It is a lisp routine that gets the intersection of two lines that do not meet. It is very useful for dimensioning to outside corners of sheet metal bends or anything else with rounded corners.

RE: lower left origin

Dear Andylaug,
I have written a VBA code for your problem as follow:


Option Explicit
Sub SetOrigin()
    Dim SOss As AcadSelectionSet
    Dim SOobj As AcadEntity
    Dim SOXMin As Double
    Dim SOYMin As Double
    Dim Minpt As Variant, Maxpt As Variant
    Dim SOorig(0 To 2) As Double
    Dim xAxis(0 To 2) As Double
    Dim yAxis(0 To 2) As Double
    Dim newUCS As AcadUCS
        
    Randomize Timer
    Set SOss = ThisDrawing.SelectionSets.Add(Rnd(Timer))
    SOss.SelectOnScreen
    ThisDrawing.SendCommand "UCS W "
    SOss.Item(0).GetBoundingBox Minpt, Maxpt
    SOXMin = Minpt(0)
    SOYMin = Minpt(1)
    For Each SOobj In SOss
        SOobj.GetBoundingBox Minpt, Maxpt
        If SOXMin > Minpt(0) Then
            SOXMin = Minpt(0)
        End If
        If SOYMin > Minpt(1) Then
            SOYMin = Minpt(1)
        End If
    Next SOobj
    SOorig(0) = SOXMin
    SOorig(1) = SOYMin
    SOorig(2) = Minpt(2)
    xAxis(0) = SOXMin + 1
    xAxis(1) = SOYMin
    xAxis(2) = Minpt(2)
    yAxis(0) = SOXMin
    yAxis(1) = SOYMin + 1
    yAxis(2) = Minpt(2)
    Set newUCS = ThisDrawing. _
    UserCoordinateSystems.Add _
    (SOorig, xAxis, yAxis, "0")
    ThisDrawing.ActiveUCS = newUCS
End Sub


You can copy and paste the code into a VBA module an just run the SetOrigin subroutine. The routine requests you to select some objects and it sets the UCS on the lower left corner of selected objects.
The subroutine can be run using a toolbutton.
:)
Farzad

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources