cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Macro for IsoDraw 7.2 Move Rectangle corner to line anchor point

BLArts
12-Amethyst

Macro for IsoDraw 7.2 Move Rectangle corner to line anchor point

Ex. I have a rectangle in my ISODraw document (this is our format border). I already have a macro that I created that will select all the text and art created for this particular document. Then aligns it all in the center of the rectangle border and then aligns to the bottom then moves it up a specific distance. So that every document of art we create is centered and at the same exact distance from the bottom of the border. The border does not change in width and the bottom of the border does not move. The height will change depending on the height of the art and text. To change the height we will move the top of the rectangle border down to the correct height. I have a line created that aligns to the top of the art and text and then moves up a specific distance to mark the spot where the top of the border line should be snapped to.

 

The part we have to do manually but I want to figure out how to code is as follows:

 

We have to manually select the top of the rectangle and drag it down to snap to the point of where the line created ended up. This spot is always different because the art and text are different depending on the document.

I want to learn how to code the macro to get the coordinates of the front anchor point then apply that coordinate as the marker for where the height of the top left corner of the rectangle border will be readjusted to.

 

Hope this makes sense! My understanding is I need to make the coordinate of the created lines front anchor point into a float and have that apply to the coordinates for the top left of the rectangle but not sure where I go to learn this kind of coding that would apply to ISODraw macro language. I've tried looking into C, C++, or searching for stuff like "Beginning SAS/IML code macro" in Youtube and Google. But everything I come across is not helping me.

Please help.

Below is the example of the macro I have so far explained above. Keep in mind it does more the what I said but what I said is the important part relating to my question. Also a pic of the line and rectangle explained above.

Macro Qustion.JPG

Macro Position Art Text 2 PROTECTED
	####Need Zoom Page to ensure Select Rectangle works correctly####
	Zoom page
	Select if Object_name contains '2017_Temp_ArrowPen_AlignBorderTop'
	Delete selection
		if (exists(activedoc.layers["ICN_TextBox"])=false) then
	define ICN_TextBox as layer
	ICN_TextBox = add layer "ICN_TextBox"
		end if
	ActiveDoc.Layers["ICN_TextBox"].Locked = false
	
		if (exists(activedoc.layers["No_Pen_Border"])=false) then
	define No_Pen_Border as layer
	No_Pen_Border = add layer "No_Pen_Border"
		end if
	Select none
	Activate layer "No_Pen_Border"
	Select if Type is equal to 'rectangle'
	Subselect if Pen is equal to '$ISO_NOPEN'
	Subselect if Color is equal to '$ISO_NOFILL'
	Subselect if Element is inside page completely
	Selected Elements to active layer
	Create object_info activeDoc.firstSelectedElement
	activeDoc.firstSelectedElement.info.name = "2017_Main_Stay_MainBorder_PenNoPen"
	activeDoc.firstSelectedElement.info.tip = "Do Not Move Bottom Position"
	Select none
	ActiveDoc.Layers["No_Pen_Border"].Locked = true
		
	####Selects ICN at Bottom Right Corner####
	Select rectangle 173.326 4.293 159.835 7.806 with_partial
	Delete selection
	
	Activate layer "Standard layer"
	ActiveDoc.Layers["Layer4"].Locked = true
	ActiveDoc.Layers["Layer3"].Locked = true
	ActiveDoc.Layers["No_Pen_Border"].Locked = true
		if (exists(activedoc.layers["ICN_TextBox"])=true) then
	ActiveDoc.Layers["ICN_TextBox"].Locked = true
		end if	
	
	####Create Temp line so if there is no text to copy and paste this will be pasted####
	Create Line 4.389 (-23.335) 23.019 (-23.335)
	Create object_info activeDoc.firstSelectedElement
	activeDoc.firstSelectedElement.info.name = "2017_Temp_Line_if_no_Text"
	activeDoc.firstSelectedElement.info.tip = "Delete After Use"
	Cut

	####Selects around No pen border but Border is locked####
	Select rectangle 0.42 225.328 182.719 0.583
	Subselect if Type is equal to 'text'
	Subselect if Font_size is equal to 10
	Copy
	Convert text to paths
	Group Selection
	Create object_info activeDoc.firstSelectedElement
	activeDoc.firstSelectedElement.info.name = "2017_Temp_AlignTextPaths"
	activeDoc.firstSelectedElement.info.tip = "Delete After Use"

	Select none
	Paste same_Position
	Move selection 0 2
	
	####Selects around No pen border but Border is locked####
	Select rectangle 0.42 225.328 182.719 0.583
	Subselect if Type is equal to 'text'
	Subselect if Font_size is equal to 10
	DEFINE el AS Element
	el = activeDoc.firstSelectedElement
		WHILE (Exists (el) = true )
	Create Object_Info el
	el.info.name = "2017_Main_CalloutText_Arial10Normal"
	el.info.tip = "Do not Resize 10 pt"
	el = el.nextSelectedElement
		END while
	Select none
	
	####Selects around No pen border but Border is locked####
	Select rectangle 0.42 225.328 182.719 0.583

	Group Selection
	Select none
	ActiveDoc.Layers["No_Pen_Border"].Locked = false
	
	####Selects around No pen border####
	Select rectangle 0.211 219.28 179.993 1.026 with_partial

	Align medium
	Align bottom
	Select none
	Set active pen "ground"
	Create Line 3.174 212.724 10.772 212.724
		Set active style "Start arrow"

	Create object_info activeDoc.firstSelectedElement
	activeDoc.firstSelectedElement.info.name = "2017_Temp_ArrowPen_AlignBorderTop"
	activeDoc.firstSelectedElement.info.tip = "Delete After Use"
	
	ActiveDoc.Layers["No_Pen_Border"].Locked = true
	####Selects around No pen border but Border is locked####
	Select rectangle 0.42 225.328 182.719 0.583
	
	Align bottom
	Move selection 0 6.348
    Select none
	Select if Object_name contains '2017_Temp_AlignTextPaths'
	Delete selection

	####Selects around No pen border####
	Select rectangle 0.211 219.28 179.993 1.026 with_partial
	UnGroup Selection

	Subselect if Type is equal to 'text'
	Subselect if Font_size is equal to 10
	Move selection 0 (-2)
	
	####Selects all within border but not 2017_Temp_ArrowPen_AlignBorderTop####
	Select rectangle 176.591 215.002 4.423 4.575
	Group Selection
	
	####Selects around No pen border####
	Select rectangle 0.211 219.28 179.993 1.026 with_partial
	Align top    
	Subselect if Type is equal to 'line'
	Move selection 0 3.174

	####Selects all within border but not 2017_Temp_ArrowPen_AlignBorderTop####
	Select rectangle 0.263 211.645 174.125 0.627
	UnGroup Selection
	Select at 178.86 (-4.778)
	Select if Font_size is equal to 10
	#Subselect if Element is inside page
	Activate layer "Layer2"
	Selected Elements to active layer
	Select none
			
	Activate layer "ICN_TextBox"	
	create text 173.06 4.82 stripExt(activedoc.name)
	text font "ariel"
	text align right
	text face normal
	text size 6
	Create object_info activeDoc.firstSelectedElement
	activeDoc.firstSelectedElement.info.name = "2017_Main_Stay_ICNText_Arial6Normal"
	activeDoc.firstSelectedElement.info.tip = "Do Not Move Position"
	select none
	
	Activate layer "Standard layer"
	Select if Object_name contains '2017_Temp_Line_if_no_Text'
	Delete selection
	Select none
	
	Select if Pen is equal to 'Arrow'
	Subselect if Object_name is not equal to '2017_Main_CalloutLine_PenArrow'
	
	el = activeDoc.firstSelectedElement
		WHILE (Exists (el) = true )
	Create Object_Info el
	el.info.name = "2017_Main_CalloutLine_PenArrow"
	el.info.tip = "0.375 Min Length"
	el = el.nextSelectedElement
		END while
	Select none
	Select if Pen is equal to 'ArrowShadow'
	Subselect if Object_name is not equal to '2017_Main_CalloutLine_PenArrow'
	el = activeDoc.firstSelectedElement
		WHILE (Exists (el) = true )
	Create Object_Info el
	el.info.name = "2017_Main_CalloutLine_PenArrow"
	el.info.tip = "0.375 Min Length"
	el = el.nextSelectedElement
		END while
	Select none
	
	ActiveDoc.Layers["Layer2"].printable = true
	ActiveDoc.Layers["Layer2"].exportable = true
	ActiveDoc.Layers["Standard layer"].printable = true
	ActiveDoc.Layers["Standard layer"].exportable = true
	ActiveDoc.Layers["Layer4"].Locked = true
	ActiveDoc.Layers["Layer4"].printable = false
	ActiveDoc.Layers["Layer4"].exportable = false
	ActiveDoc.Layers["Layer4"].visible = true
	ActiveDoc.Layers["Layer3"].Locked = true
	ActiveDoc.Layers["Layer3"].printable = false
	ActiveDoc.Layers["Layer3"].exportable = false
	ActiveDoc.Layers["Layer3"].visible = true
	ActiveDoc.Layers["ICN_TextBox"].Locked = true
	ActiveDoc.Layers["ICN_TextBox"].printable = true
	ActiveDoc.Layers["ICN_TextBox"].exportable = true
	ActiveDoc.Layers["ICN_TextBox"].visible = true
	ActiveDoc.Layers["No_Pen_Border"].Locked = false
	ActiveDoc.Layers["No_Pen_Border"].printable = true
	ActiveDoc.Layers["No_Pen_Border"].exportable = true
	ActiveDoc.Layers["No_Pen_Border"].visible = true
		
	Set active pen "Medium"
	Zoom page
	activedoc.window.preview = 0

End Macro
ACCEPTED SOLUTION

Accepted Solutions
BLArts
12-Amethyst
(To:BLArts)

I figured it out!

 

Macro Breakthrough

DEFINE pathstart AS float
DEFINE pathend AS float

		Select if Object_name contains '2017_Temp_ArrowPen_AlignBorderTop'
pathstart = activeDoc.firstSelectedElement.line.segments[1].endPoint.y
Select if Object_name contains '2017_Main_Stay_MainBorder_PenNoPen'
	activeDoc.firstSelectedElement.rect.segments[3].endPoint.y =  pathstart
	Select if Object_name contains '2017_Temp_ArrowPen_AlignBorderTop'
pathend = activeDoc.firstSelectedElement.line.segments[1].endPoint.y
Select if Object_name contains '2017_Main_Stay_MainBorder_PenNoPen'
	activeDoc.firstSelectedElement.rect.segments[2].endPoint.y =  pathend
	
End macro

View solution in original post

5 REPLIES 5
BLArts
12-Amethyst
(To:BLArts)

I figured it out!

 

Macro Breakthrough

DEFINE pathstart AS float
DEFINE pathend AS float

		Select if Object_name contains '2017_Temp_ArrowPen_AlignBorderTop'
pathstart = activeDoc.firstSelectedElement.line.segments[1].endPoint.y
Select if Object_name contains '2017_Main_Stay_MainBorder_PenNoPen'
	activeDoc.firstSelectedElement.rect.segments[3].endPoint.y =  pathstart
	Select if Object_name contains '2017_Temp_ArrowPen_AlignBorderTop'
pathend = activeDoc.firstSelectedElement.line.segments[1].endPoint.y
Select if Object_name contains '2017_Main_Stay_MainBorder_PenNoPen'
	activeDoc.firstSelectedElement.rect.segments[2].endPoint.y =  pathend
	
End macro
VishwaPatil17
4-Participant
(To:BLArts)

Hi,

 I am Vishwanath. Working as a lead Engineer. I do work on technical illustrations. I need a help on creating a macro to delete the profile outside the border in Isodraw.

Let me explain in detail. I Have a standard template of size 170*200. I will fit my profile within the boundary (170*222). If any line or any profile exists outside the boundary (170*222), it has to be deleted. So please help me if there is any macro to delete the profile using batch process.

I'm not sure what you're saying but if you need to delete objects that are in a certain area then you can record selecting in these areas then delete and you have your macro.

VishwaPatil17
4-Participant
(To:BLArts)

Thanks for reply.

I have certain boundary which is fixed for all files, but if any object present outside the fixed boundary should be deleted. Object outside the boundary can exist at any location. So I cannot record macro for that. For better clarity I have attached a JPG file. In that you can see I have a fixed boundary (170*222). In that Object A or Object B is wrongly placed outside the fixed boundary, And it has to be deleted. The location of Object A or Object B can vary. So my question is there is any possibility to create a Macro, which will delete anything which is present outside the fixed boundary (170*222).Please let me know if any possibilities.

You may be able to simply use

Select if Element is outside page

Delete selection

You need to download the ISODraw Macro PDF "Arbortext IsoDraw Macro Language Reference 7.3.pdf"

Just do a Google search for the PDF by name above.

This has what you need and more. In this case you're looking for "[Sub]Select If Element"

Announcements

Top Tags