Looking for a way to test if the lines in a path intersect any objects?
What i'd like to do is select an open ended path, and generate an array of all the objects that path intersects. Here's an image to illustrate:
The green line would be selected. The script would run and populate an array with pointers to each yellow square the line intersects. Does anyone have any ideas on how this can be done in javascript? Or if it is possible at all? Help is appreacited, thanks!
Sure it's possible. If all of your objects-to-cross are rectangles (as in your image), it's even quite trivial.
(15 minutes later) Oh well, perhaps not "trivial" -- I'd have to check at home whether or not I got a full-fledged rectangle intersection code. This doesn't work -- the "crossObject" function needs a bit more work.
At least it'll give you something to look at.
if (app.selection.length != 1)
alert ("Wot no single path selected?");
else
if (!(app.selection[0] instanceof PathItem))
alert ("Wot no path?");
else
allObjects = [];
for (i=0; i<app.activeDocument.pageItems.length; i++)
if (!app.activeDocument.pageItems[i].selected)
allObjects.push (app.activeDocument.pageItems[i]);
thePath = [];
for (i=0; i<app.selection[0].pathPoints.length; i++)
thePath.push ([ app.selection[0].pathPoints[i].anchor[0],app.selection[0].pathPoints[i].anchor[1] ] );
app.selection[0].selected = false;
for (i=0; i<thePath.length-1; i++)
for (j=0; j<allObjects.length; j++)
// only check if necessary
if (allObjects[j].selected == true)
continue;
if (crossObject (thePath[i], thePath[i+1], allObjects[j]))
allObjects[j].selected = true;
// .. to do .. (dis doesn't work)
// (check Liang-Barsky or Cohen-Sutherland viewport clipping)
function crossObject (a, b, obj)
var xl = obj.visibleBounds[1];
var xr = obj.visibleBounds[3];
var yt = obj.visibleBounds[0];
var yb = obj.visibleBounds[2];
var x1 = a[0],y1 = a[1];
var x2 = b[0],y2 = b[1];
// if point is inside object, it (obviously) hits
if (x1 > xl && x1 < xr && y1 > yt && y1 < yb)
return true;
if (x2 > xl && x2 < xr && y2 > yt && y2 < yb)
return true;
return false;
Similar Messages
-
Looking for a way to find out the x,y coordinates of a string inside a PDF
Hi!
I'm looking for a way to find out the x,y coordinates of a string inside a PDF (with free java api's only)
I got a pdf, and a string to find inside it, what i need to do is to get this string x,y position inside that pdf....
If any one knows of such, plz let me know...
Thanx ahead
Daniel.vedmack wrote:
Hi!
I'm looking for a way to find out the x,y coordinates of a string inside a PDF (with free java api's only)
I got a pdf, and a string to find inside it, what i need to do is to get this string x,y position inside that pdf....
If any one knows of such, plz let me know...
Thanx ahead
Daniel.AFAIK, a string of text does not have an (x,y) location inside a PDF file. The location is exists on your screen, and will differ whenever you adjust the resolution of it. Text can have a location when it's stored as an image though, but than it's really the location of a certain number of pixels (not necessarily a string!). -
Looking for a way to programmatically set the visible portion of the front panel when a subVI opens
I am looking for a way to programmatically set the visible portion of the front panel when a subVI opens. Haven't found any posts that relate, but I'm not sure how to ask the right question. To be clear, I want to write a helper VI to go through a list of subVIs to make sure the background images are all in the same place when their respective subVIs open. I hate manually playing with scroll bars before I save each of the VIs... I'm figuring I need to find the top/left location of the background image (know how to do this already) and then set a VI FP property to these values or some offset, but I can't find the relevant property. FP:run-timeposition:custom looked promissing, but only affects the location of the window, not the area of the front panel the window is displaying.
Solved!
Go to Solution.Cool. Getting closer. The way I implemented your suggestion affects the subVI only if it is open. I can use this to do what I'm after, perhaps putting the code into each subVI. Maybe open all subs, run the helper, and save. Seems like I'm missing the elegant version...
My proof of concept code: -
Looking for automated way to test print PnP printer after install then delete
At times we test 20 to 30 printers in a day. I am looking for automated ways to increase the efficiency of this. I would like to simply have the printer install using PnP print a test page then delete itself after the test page or on removal. Are there any settings that can be changed on the computer to change the PnP process to make this possible. I am currently trying to learn and understand the Plug and play process so that I may find out how to get started. Any ideas would be greatly appreciated.
Thanks
This topic first appeared in the Spiceworks CommunityChris
I spent all day Googling and doing side by side comparisons of my old and new systems.
My display is a Dell U2410. It has several presets, including sRGB and Adobe RGB. I've been using sRGB.
On my OLD system, (Win XP, PsCS2, DwCS4) there seems to be no distinction between color managed and non color managed apps, even on this wide gamut display. I could capture (digital camera) in Adobe RGB, open and edit in PsCS2, save as .psd, convert to CMYK for print, or convert to sRGB for SFW. All images looked identical and they printed and displayed perfectly. I thought this was normal, and seemed logical. This also seems to be the source of my incorrect assumptions. I was trying to get my new machine to behave like my old one.
So I get this new machine (Windows 7, PsCS5, DwCS5) and now (still in sRGB display mode) all color managed apps appear de-saturated. Non color managed apps are OK. If I switch the display to Adobe RGB, color managed apps are OK, but non color managed apps are way too saturated. From my investigation, I believe this is normal behavior on a wide gamut display. I've tried changing the Control Panel > Display > Screen Resolution > Advanced settings > Color Management options, but to no avail. Either I'm missing something, or Windows 7 is doing color management differently.
It seems my only option now is to use Adobe RGB display setting for Ps, etc. and switch to sRGB for Dw and non color managed apps. Or, have 2 separate files for print and web. I've Googled 'til my eyes are numb and still not sure I'm getting this. Any enlightenment would be greatly appreciated.
Finally, I don't see an edit function here, so I can't remove my previous incorrect reply. Moderator, please feel free to do so.
Thanks -
Looking for a way to hide/collapse the display of menu bar items
I've searched the web but I cannot find any utilities that would allow me to hide the items on my menu bar, which is getting a bit cluttered. Particularly when some programs are running, if those programs have a certain number of drop down menus, the menus on the right hand side overlay some of the left side menu bar icons. It would be nice to be able to collapse & un-collapse the menu bar icons when desired.
Not really a problem on my PowerMac which has a 23" display, but moreso on my 15" MBP.As an aside; if you need to keep several apps fairly close to hand without cluttering the menu bar or dock, create a folder within your Applications folder, and place aliases of the apps in there, then drag the folder to the dock below the divider (next to the trash). Right click on the folder in the dock to get a pop-up list to choose from. I use the same idea for frequently used files and games too (seperate folders)
-
Looking for best way to test for a program
I like test path better. My problem is through all the different versions of office they cant all install to the same directory. Research time.
I'm writing a script that will automatically install Outlook 2010 if Office 2013, 2010, 2007, or 2003 are not installed. It's part of a script I already have each tech has to run locally due to management decisions(that I have no control over). Right now I prompt the tech if they want to install it. Then test for the installer and install it.
PowershellDo{$outlook = read-host "Would you like to install Outlook 2010? y/n" IF ($outlook -eq "y") { If (Test-Path -Path C:\Update\outlook2010) { saps -filepath C:\update\outlook2010\setup.exe -wait } Else { Write-host "Outlook is not in the update folder!" -ForegroundColor Red } }ElseIF ($outlook -eq "n") { Write-Host "Please make sure there is an email client." -ForegroundColor Yellow }}While ('y','n' -notcontains $outlook)What I would like to do is remove the prompt as it's a volume license...
This topic first appeared in the Spiceworks Community -
Looking for some help!! Using the Line In on macbook
I have my xbox 360 connected to my external Dell monitor via the HD VGA cable. Video works fine. Off that cable are the 2 left/right RCA male jacks. Luckily, microsoft includes the Y adapter to a 3.5mm jack. I connected this to my macbook's LINE IN on the side. I then selected Line In via the Sound Controls in Sys. Prefs.....yet, I do not get any sound!!!
In the xbox 360, I have the audio set to digital output (the basic one). All my speakers are turned on, volume is up, yet I have no audio....am I really missing something here? Is the macbook even capable of reading and outputing the audio from the xbox 360 ?
Message was edited by: David MacVicarAll my speakers are turned on, volume is up, yet I have no audio....am I really missing something here?
What audio application do you have open that should be playing the audio for you? The audio won't just "pass through" your MacBook unless you have an application open to receive and play the audio.
In the xbox 360, I have the audio set to digital output (the basic one).
The two RCA jacks on the xbox 360 aren't "digital" ports. I don't have an xbox 360, but what other options for audio out do you have? There should be an analog option for the RCA ports.
-Doug -
Looking for a way to broadcast a line in to the Airpot Express?
Looking for a way to run line input into my macbook and broadcast it to the Airport Express to Play on my Stereo..
It is discussed on the xfce forums but unfortunately that solution requires editing by hand. However it does seem relatively easy to automate. Writing a graphical program for those tasks is something you'd only have to do once.
-
Hi all, I look for a way to create a PDF from the printer ios, as I can solve, thanks
Try this process on your Mac. These files will be regenerated by Mac OS X with default settings.
1. Quit the Mac App Store
2. Trash the following folders and files; (~ is your Home folder)
~/Library/Caches/com.apple.appstore
~/Library/Caches/com.apple.storeagent
~/Library/Cookies/com.apple.appstore.plist
~/Library/Preferences/com.apple.appstore.plist
~/Library/Preferences/com.apple.storeagent.plist
~/Library/Preferences/com.apple.streagent.plist.lockfile
Mac HD/Library/Preferences/SystemConfiguration/networkinterfaces.plist
3. Restart your Mac
4. Open the Mac App Store
5. Log into your MAS account -
We are currently looking for a way to link images to a design file within programs like InDesign and Illustrator using an HTML link instead of a local file. We are hosting our images in SharePoint and need the design file to retain it's links, no matter who on our network opens the design file.
The Cloud forum is not about using individual programs
The Cloud forum is about the Cloud as a delivery & install process
If you will start at the Forums Index https://forums.adobe.com/welcome
You will be able to select a forum for the specific Adobe product(s) you use
Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll -
Im using 10.7.4 and looking for a way to change the streaming port on quicktime x
used to be able to do via system preferences > quick time > advanced
But cant find these settings anymore
Thanks
PaviClick on the pull down window next to From: and you should be able to select the individual account you want to send from. The account that you want to send from must be an Enabled account in the Account Preferences of Mail.
-
I am looking for a way to develop a grammar checker for the web like spellcheckerplus can you help? I have my own dictionary for comparing and replacing words.
Hi,
The forum is about install/uninstall .NET Framework, please post your issue to dev related forum instead of here.
Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
My operating system is OS X Yosemite 10.10.2 Suddenly one (only) of my email accounts is not pulling in new emails. I ran the Connection Doctor which indicated all connections are ok. I am looking for another way to troubleshoot or a solution.
Mail troubleshooting - Yosemite
Mail (Yosemite): If you can’t receive messages
Troubleshooting sending and receiving email messages -
I am looking for a way to enter multiple dates into a field without the form becoming too long.
This will be used by an old school bookeeper who needs the form to fit on one page.
Any ideas?Hi,
If you don't need the field to provide a date picker, verify it's a date, or don't need to sort the dates in the table, you can just use a text area field, and have your form filler enter the dates comma separated. Otherwise you'd have to add multiple fields. However, you can lessen the space each field takes up veritically, by using the "Labels Left" option (in the toolbar).
Thanks,
Todd -
I am looking for a way to disable the windows ct
rl-alt-del function in a LabVIEW 6.0 VI. I also need to disable the bottom task bar including the Start key in Windows NT 4.0. My goal is to keep the VI exclusively on the screen and disable the users from switching to other programs or shut off the PC.
rl-alt-del function in a LabVIEW 6.0 VI. I also need to disable the bottom task bar including the Start key in Windows NT 4.0. My goal is to keep the VI exclusively on the screen and disable the users from switching to other programs or shut off the PC.Public libraries use applications like WinSelect to lock down access to machines.
http://www.winselect.com/
But control-alt-delete in NT4.0 is a kernel level security feature that can't be
defeated unless you hide the keyboard. By using registry settings you can
control what is presented to the user after he hits control-alt-delete and keep
him/her from shutting down, but you will also have to lock up the computer to keep
your users from hitting the reset button and hide the mouse.
If you want to boot up an NT environment without a keyboard and mouse
you will need to go to NT Embedded. NTE allows you to build a custom
OS that does not require keyboard or mouse to boot. You can also install
just the components you need, ie; no browser, menus, control panel, etc.
Regards,
Alan
"Dan Huynh" wrote in message news:[email protected]..
> I am looking for a way to disable the windows ctrl-alt-del function in
> a LabVIEW 6.0 VI. I also need to disable the bottom task bar
> including the Start key in Windows NT 4.0. My goal is to keep the VI
> exclusively on the screen and disable the users from switching to
> other programs or shut off the PC.
>
>
Maybe you are looking for
-
Some software dmg's download and install. Others end with an "unexpected error message". For example, update to my HP Printer from the app store installed with no problem. The upgrade to Mountain Lion from the app store ended with the error message.
-
How do you create photo galleries in Dreamweaver CS5?
Hi, I am trying to figure out how to create a photo gallery for my website http://www.topworlddirectory.com Please suggest. My site is built in classic ASP. Does Dreamweaver have a built in tool , widget to do this? thx kansun
-
Replace the Glossy Screen with the Matte Screen on a 2008 Macbook Pro?
Can you replace the Glossy Screen with the Matte Screen on a 2008 Macbook Pro? Where would I get a Matte Screen for a reasonable price if I could change it?
-
My apple id will not allow Garageband and iMove to update?
OSX 10.7.7 Imac Doing a software update the Store Application asked for my Apple ID which was fine except it updated only iPhoto. It will not update Garageband or iMove because its says that I am using the wrong Apple Id?? Is there a way to delete
-
Problem with very new install.
I have a clean HD and want to put Solaris 10 on it. I downloaded and burned the install onto 5 CD-r. When I boot the system, it doesn't boot to the CD rom. I have changed the boot sequence in the bios. What else do I need to do to start the install?